GetMana() public method

public GetMana ( ) : float
return float
示例#1
0
文件: Ability.cs 项目: UnityRPGv2/RPG
        public override bool Use(GameObject user)
        {
            Mana mana = user.GetComponent <Mana>();

            if (mana.GetMana() < manaCost)
            {
                return(false);
            }

            CooldownStore cooldownStore = user.GetComponent <CooldownStore>();

            if (cooldownStore.GetTimeRemaining(this) > 0)
            {
                return(false);
            }

            AbilityData data = new AbilityData(user);

            ActionScheduler actionScheduler = user.GetComponent <ActionScheduler>();

            actionScheduler.StartAction(data);

            targetingStrategy.StartTargeting(data,
                                             () => {
                TargetAquired(data);
            });

            return(true);
        }
    // Update is called once per frame
    void Update()
    {
        float pctFull = DragonMana.GetMana(ThisDragonType) / 100f;

        switch (ThisDragonType)
        {
        case DragonType.eDragonType.AirDragon:
        case DragonType.eDragonType.EarthDragon:
            transform.localScale = new Vector3(1f, pctFull, 1f);
            break;

        case DragonType.eDragonType.WaterDragon:
        case DragonType.eDragonType.FireDragon:
            transform.localScale = new Vector3(pctFull, 1f, 1f);
            break;
        }



        if (pctFull == 1)
        {
            color.a     = Mathf.Abs(Mathf.Sin(Time.time * 1.65f)); // Trying to get the pulses to match up with the music!!
            image.color = color;
        }
        else
        {
            color.a     = 255;
            image.color = color;
        }
    }
示例#3
0
 public void Spawn(Character character, Transform pos)
 {
     if (CanSpawn(character))
     {
         Character c = Instantiate(character, pos);
         c.transform.position = base1.transform.position + spawnOffsetFromBase;
         c.tag = "Player 1";
         Mana targetMana = Mana.GetMana(c.type, allManas);
         if (targetMana != null)
         {
             targetMana.SpendMana(c.manaCost);
         }
     }
 }
    // Update is called once per frame
    public void Change(int ? id = null)
    {
        if (id == null)
            playerid = 0;
        else
            playerid = (int)id;
        Player_PF = main_process.GetPlayerObject(id);
        Player_Script = main_process.GetPlayerScript(id);
        Player_EXP = main_process.GetPlayerExperience(id);
        Player_Health = Player_PF.GetComponent<Health>();
        Player_Mana = Player_PF.GetComponent<Mana>();
        Player_Defense = Player_PF.GetComponent<Defense>();
        Player_ATK = Player_Script.AttackCollider.GetComponent<DealDamage>();

        //if (!Player_ATK)
        //    Debug.Log("Cannot Get Player_ATK");
        ATK.text = Player_Script.GetTotalStrength().ToString();
        DEF.text = Player_Defense.defense.ToString();
        STA.text = Player_Script.GetTotalStamina().ToString();
        SPI.text = Player_Script.GetTotalIntelligence().ToString();
        AGI.text = Player_Script.GetTotalAgility().ToString();
        BATK.text = "<color=#ffffffff>" + Player_ATK.GetDamageI().ToString() + "-" + Player_ATK.GetDamageI().ToString() + "</color>";
        MATK.text = "<color=#ffffffff>" + Player_ATK.GetDamageI().ToString() + "-" + Player_ATK.GetDamageI().ToString() + "</color>";
        PDEF.text = Player_Defense.GetPhysicalDefense().ToString();
        MDEF.text = Player_Defense.GetMagicalDefense().ToString();
        //CRIR.text = (Player_ATK.GetCriticalChance()*100).ToString()+"%";
        C_ICON.sprite = CI.Class_info[Player_Script.GetClassID()].icon;
        C_HP.text = Player_Health.GetCurrentHealth().ToString() + "/" + Player_Health.GetMaxHP().ToString();
        CRIR.text = "0.00%";
        C_MP.text = Player_Mana.GetMana().ToString() + "/" + Player_Mana.MaxMana.ToString();
        C_LV.text = Player_EXP.GetCurrentLevel().ToString();
        C_EXP.text = Player_EXP.GetExperience().ToString();
        C_NEXP.text = (Player_EXP.GetNEXP()-Player_EXP.GetExperience()).ToString();
        C_Name.text = Player_Script.Player_Name;
        weapon.sprite = CI.Class_info[Player_Script.GetClassID()].weapon[Player_Script.GetWeaponLV()].icon;
        amror.sprite = CI.Class_info[Player_Script.GetClassID()].armor[Player_Script.GetAmrorLV()].icon;
        accer.sprite = CI.Class_info[Player_Script.GetClassID()].accessory[Player_Script.GetAccessoriesLV()].icon;
        C_PASP.text = Player_PF.GetComponent<PassiveSkillManager>().getAvailablePoints().ToString();
        select_current = 1;
        gem_selecting = false;
        passive_selecting = false;
        gem_system.manager = main_process.GetPlayerGemManager(playerid);
    }