HeroAttackController.cs 1.05 KB
Newer Older
1 2 3
using UnityEngine;
using System.Collections;

4
public class HeroAttackController : MonoBehaviour {
5 6

    enum ability {fireball, water, others };
7 8
	public int direction;
	public float speed;
9 10

    private ability currentAbility = ability.fireball;
11
	public GameObject FireballPrefab;
12 13 14 15 16 17 18 19 20 21 22

	// Use this for initialization
	void Start () {
       
	}

    // Update is called once per frame
    void Update(){
        if (Input.GetButtonDown("Fire1")){
            switch (currentAbility)
            {
23 24 25 26 27
			case ability.fireball:
				GameObject clone = Instantiate (FireballPrefab, new Vector3 (0, 0, 0), Quaternion.identity) as GameObject;
				clone.GetComponent<FireballMove> ().move = GetComponent<PlayerAnimation> ().lastInput;
				clone.GetComponent<FireballMove> ().speed = speed;
			
28 29 30 31 32 33 34
                    Debug.Log("fireball");
                    break;
                default:
                    Debug.Log("default");
                    break;
            }

35
        }
36 37 38 39 40 41 42
        if (Input.GetButtonDown("Fire2")){
                Debug.Log("melee");
        }
    }
       
}