コード例 #1
0
 private void Cast()
 {
     if (Input.GetMouseButtonDown(1) && Time.time >= _timeToFire[0] && _manaSystem.GetMana() > magicInfo[0].Price)
     {
         _manaSystem.Damage(magicInfo[0].Price);
         HealthSystemUI.Instance.UseMana(magicInfo[0].Price);
         Debug.Log(magicInfo[0].Price > _manaSystem.GetMana());
         _timeToFire[0] = Time.time + magicInfo[0].FireRate;
         _player.GetAnimator().SetTrigger(LightAttack);
         _abilityUI.CastUi(magicInfo[0].TimeCast);
         _abilityUI.UseAbility(0, magicInfo[0].FireRate);
         _player.GetCastMagic().ShootProjectile(magicInfo[0]);
     }
     else if (Input.GetKeyDown(KeyCode.Q) && Time.time >= _timeToFire[1] && _manaSystem.GetMana() > magicInfo[1].Price)
     {
         _manaSystem.Damage(magicInfo[1].Price);
         HealthSystemUI.Instance.UseMana(magicInfo[1].Price);
         _timeToFire[1] = Time.time + magicInfo[1].FireRate;
         _player.GetNavMeshAgent().isStopped = true;
         _player.GetAnimator().SetTrigger(BlackHole);
         _abilityUI.CastUi(magicInfo[1].TimeCast);
         _abilityUI.UseAbility(1, magicInfo[1].FireRate);
         _player.GetCastMagic().ShootProjectile(magicInfo[1]);
     }
 }
コード例 #2
0
    public void InitManaUI()
    {
        int manaValue = manaSystem.GetMana();

        manaSystemStatic = manaSystem;

        _manaBar.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 0.5f);
        SetPositionManaUI(manaValue);

        manaSystem.OnDecrease += RefreshMana;
        manaSystem.OnIncrease += RefreshMana;
    }