Esempio n. 1
0
File: Hero.cs Progetto: Kinderril/p3
//    public float CurrenthBonus
//    {
//        get { return currenthBonus; }
//        set
//        {
//            currenthBonus = value;
//            if (CurrentBonusUpdateX != null)
//            {
//                CurrentBonusUpdateX( currenthBonus );
//            }
//        }
//    }

    public void Init(Level lvl)
    {
        base.Init();
        var playerData = MainController.Instance.PlayerData;
        var allWeared = playerData.GetAllWearedItems();
        var notBonuses = allWeared.Where(x => x.Slot != Slot.bonus);
        var bonuses = allWeared.Where(x => x.Slot == Slot.bonus);
        foreach (var allWearedItem in notBonuses)
        {
            allWearedItem.Activate(this, lvl);
        }
        foreach (var bonuseItem in bonuses)
        {
            bonuseItem.Activate(this, lvl);
        }

        foreach (ParamType v in Enum.GetValues(typeof(ParamType)))
        {
            Parameters[v] = playerData.CalcParameter(v);
            Debug.Log("Calc parameter: " + v + " : " + Parameters[v]);
        }
        curHp = Parameters[ParamType.Heath];
        Parameters[ParamType.Speed] /= Formuls.SpeedCoef; ;
//        Parameters.Parameters[ParamType.PPower] *= (damageBonusFromItem + 1f);
//        Parameters.Parameters[ParamType.MPower] *= (damageBonusFromItem + 1f);
//        GetItemEffect.Stop(true);
        heorControl = Control as HeroControl;
        heorControl.Init(OnRotationEnds);
        Utils.GroundTransform(transform);
    }
Esempio n. 2
0
    public override void Init()
    {
        base.Init();
        var playerData = MainController.Instance.PlayerData;
        foreach (ParamType v in Enum.GetValues(typeof(ParamType)))
        {
            Parameters.Parameters[v] = playerData.CalcParameter(v);
            Debug.Log("Calc parameter: " + v + " : " + Parameters.Parameters[v]);
        }
        curHp = Parameters.Parameters[ParamType.Hp];

        Parameters.Parameters[ParamType.PPower] *= damageBonusFromItem + 1f;
        Parameters.Parameters[ParamType.MPower] *= damageBonusFromItem + 1f;
//        GetItemEffect.Stop(true);
        heorControl = Control as HeroControl;
        heorControl.Init(OnRotationEnds);
        Utils.GroundTransform(transform);
    }