// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.RightControl) && AmmoHolder.Ammo > 0) { Instantiate(Projectile, FirePoint.position, FirePoint.rotation); AmmoHolder.ChangeAmmo(-1); } }
private void getAmmunition() { ammunition = gameObject.AddComponent <AmmoHolder> (); if (isLeft) { ammunition.displacement = .8f; ammunition.farthestLeftLoc = new Vector2(-9.4f, 4.3f); } else { ammunition.displacement = .8f; ammunition.farthestLeftLoc = new Vector2(9.4f - 2 * ammunition.displacement, 4.3f); } }