﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerInput : MonoBehaviour {
    public GameObject forceExplosion;
    // Use this for initialization
    void Start() {

    }

    // Update is called once per frame
    void Update() {
        if (Input.GetKeyDown(KeyCode.W)) {
            NotificationCenter.DefaultCenter.PostNotification(this, "ForceUp");
        }
        if (Input.GetKeyDown(KeyCode.S)) {
            NotificationCenter.DefaultCenter.PostNotification(this, "ForceDown");
        }

        if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.LeftControl) ||
            Input.GetKeyDown(KeyCode.LeftControl) && Input.GetKey(KeyCode.Space)) {
            NotificationCenter.DefaultCenter.PostNotification(this, "GoodForceAttack");
        } else {
            if (Input.GetKeyDown(KeyCode.Space)) {
                NotificationCenter.DefaultCenter.PostNotification(this, "ForceAttack");
            }
        }

        if (Input.GetMouseButtonDown(0)) {
            Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Instantiate(forceExplosion, mousePosition, Quaternion.identity);
        }
    }
}
