Esempio n. 1
0
    private void InternalAttack()
    {
        var firstAttack = _intell.UnitActionState != UnitActionState.Attacking;

        Intell.SetPrimaryState(UnitPrimaryState.Busy, changeState: true);
        _intell.UnitActionState = UnitActionState.Attacking;

        if (Avatar == null)
        {
            return;
        }

        if (_previousAttackAttackSpeed != Stats.AttackSpeed)
        {
            AttackSpeedChanged();
        }

        _isAttacking = true;

        var animTime = AnimationUtils.GetAnimationLength(Avatar, "Reload_Body", basedOnSpeed: true);

        InternalReload(firstAttack: firstAttack);

        Timer._.InternalWait(AfterReload, animTime);
    }
Esempio n. 2
0
    public void DisableColliders()
    {
        if (Intell == null)
        {
            Intell = GetComponent <Intell>();
        }
        Intell.AtackSensor.gameObject.SetActive(false);
        Intell.ViewSensor.gameObject.SetActive(false);

        GetComponent <CapsuleCollider>().enabled = false;
    }
Esempio n. 3
0
 private void SetupInteligence(IAm iAm)
 {
     Intell = GetComponent <Intell>();
     if (Intell == null)
     {
         Debug.LogError("Unit has no inteligence.");
         return;
     }
     _unit.Intell = Intell;
     Intell.IAm   = iAm;
     Intell.Init(_unit);
     gameObject.tag = iAm.ToString();
 }
Esempio n. 4
0
    public void Init(Unit.OnHit onHit)
    {
        _onHit = onHit;

        Intell.SetPrimaryState(UnitPrimaryState.Idle, changeState: true);
        Arrow.gameObject.SetActive(false);

        if (Stats.AttackSpeed == 0)
        {
            Stats.AttackSpeed = FightUtils.GetDefaultAttackSpeed(Avatar, "Reload_Body", "Attack_Body");
        }

        AttackSpeedChanged();
    }
Esempio n. 5
0
    private void InternalRun()
    {
        StopAttack();

        Intell.SetPrimaryState(UnitPrimaryState.Walk);
        _intell.UnitActionState = UnitActionState.Searching;

        Arrow.gameObject.SetActive(false);
        AnimationUtils.PlayAnimation(
            "Run", Avatar
            , accessory: Cape, accessoryName: "Body"
            , accessory2: Bow, accessory2Name: "Bow"
            );
    }
Esempio n. 6
0
    private void InternalDeath()
    {
        Intell.SetPrimaryState(UnitPrimaryState.Idle, changeState: true);
        _intell.UnitActionState = UnitActionState.Searching;

        StopAttack();

        Avatar.Stop();
        Cape.Stop();
        if (Arrow.gameObject.activeSelf)
        {
            Arrow.Stop();
        }
        Bow.Stop();
    }