public void AddAmmunition(float percent) { actions act = atb.GetActions(); int limit = act.GetWeaponInfs().GetLimitBulets(); int value = (int)(limit * percent); AddAmmunition(value); }
public void AddAmmunition(int add) { actions act = atb.GetActions(); int limit = act.GetWeaponInfs().GetLimitBulets(); /*ammunition += add; * * if (ammunition <= 0) * { * act.SetWeapon(null); * textAmmunition.gameObject.SetActive(false); * } * else * { * if (!textAmmunition.gameObject.activeInHierarchy) * textAmmunition.gameObject.SetActive(true); * * textAmmunition.text = "" + ammunition; * * if (ammunition > limit) * ammunition = limit; * }*/ }
// Update is called once per frame void Update() { if (canMove) { actions act = atb.GetActions(); //Movimentação Vector2 dire = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); movementPlayer.Move(dire); //Pegando posição do mouse no mundo /*Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); * Vector2 delta = mousePos; * delta.x -= transform.position.x; * delta.y -= transform.position.y; * //Rotacionar * float angZ = Vector2.SignedAngle(Vector2.up, delta); * movementPlayer.TurnTo(angZ);*/ weaponInfs wp = act.GetWeaponInfs(); //Comando de atirar /*if (Input.GetButton("Fire1")) * { * if (Input.GetButtonDown("Fire1")) * { * act.Fire(); * } * } * else if (wp && wp.IsContinuous()) * { * act.StopFire(); * }*/ } }