void OnTriggerEnter2D(Collider2D Other) { if (Other.GetComponent <Rigidbody2D> () == null) { return; } EggCount.AddAmmo(AmmoToAdd); Destroy(gameObject); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.RightControl) && EggCount.Ammo > 0) { Instantiate(Projectile, FirePoint.position, FirePoint.rotation); EggCount.AddAmmo(-AmmoUse); animator.SetBool("isAttacking", true); } else if (Input.GetKeyUp(KeyCode.RightControl)) { animator.SetBool("isAttacking", false); } }