void Update() { if (Input.GetKey(KeyCode.Space)) { attack.Attack(); } if (Input.GetKeyUp(KeyCode.Space)) { attack.AttackEnd(); } }
// Update is called once per frame void Update() { attack = GetComponent <BaseAttack>(); if (Input.GetKeyDown(KeyCode.Space)) { attack.Attack(); } if (Input.GetKey(leftKey)) //move left { rb2d.AddForce(Vector2.left * forceMod); } if (Input.GetKey(rightKey)) //move right { rb2d.AddForce(Vector2.right * forceMod); } if (Input.GetKeyDown(KeyCode.B)) //change to BaseShield { Destroy(shield); shield = gameObject.AddComponent <BaseShield>(); } if (Input.GetKeyDown(KeyCode.T)) { Destroy(shield); shield = gameObject.AddComponent <TeleportShield>(); } if (Input.GetKeyDown(KeyCode.H)) { Destroy(shield); shield = gameObject.AddComponent <HalfDamangeShield>(); } }
public IEnumerator Attack() { yield return(StartCoroutine(attack.Attack())); }