Ejemplo n.º 1
0
    private void Start()
    {
        lifesystem = new CharLifeSystem(life, life)
                     .ADD_EVENT_OnGainLife(OnGainLife)
                     .ADD_EVENT_OnLoseLife(OnLoseLife)
                     .ADD_EVENT_Death(OnDeath)
                     .ADD_EVENT_OnChangeValue(OnChangeLife);

        charanim  = new CharacterAnimator(anim_base);
        customCam = FindObjectOfType <CustomCamera>();

        move = new CharacterMovement(GetComponent <Rigidbody>(), rot, charanim)
               .SetSpeed(speed)
               .SetTimerDash(dashTiming).SetDashSpeed(dashSpeed)
               .SetDashCD(dashCD)
               .SetRollDeceleration(dashDeceleration);

        InDash           += move.IsDash;
        ChildrensUpdates += move.OnUpdate;
        move.SetCallbacks(OnBeginRoll, OnEndRoll);

        charBlock           = new CharacterBlock(_timerOfParry, blockAngle, _timeOfBlock, maxBlockCharges, timeToRecuperateCharges, chargesUI, charanim, GetSM, inParryParticles);
        charBlock.OnParry  += () => charanim.Parry(true);
        charBlock.EndBlock += EVENT_UpBlocking;
        ChildrensUpdates   += charBlock.OnUpdate;

        dmg        = dmg_normal;
        charAttack = new CharacterAttack(attackRange, attackAngle, timeToHeavyAttack, charanim, rot, ReleaseInNormal, ReleaseInHeavy, feedbackHeavy, dmg, slash);
        charAttack.FirstAttackReady(true);

        charAnimEvent.Add_Callback("CheckAttackType", CheckAttackType);
        charAnimEvent.Add_Callback("DealAttack", DealAttack);
        charAnimEvent.Add_Callback("EndAttack", EndAttack);
        charAnimEvent.Add_Callback("RompeCoco", RompeCoco);
        charAnimEvent.Add_Callback("BeginBlock", charBlock.OnBlockSuccessful);
        charAnimEvent.Add_Callback("Dash", move.RollForAnim);

        SetStates();

        rb = GetComponent <Rigidbody>();

        StartDebug();
    }
Ejemplo n.º 2
0
 private void Start()
 {
     _hero    = Main.instance.GetChar();
     heroLife = _hero.Life;
     maxHP    = heroLife.GetMax();
 }