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); }
public void DisableColliders() { if (Intell == null) { Intell = GetComponent <Intell>(); } Intell.AtackSensor.gameObject.SetActive(false); Intell.ViewSensor.gameObject.SetActive(false); GetComponent <CapsuleCollider>().enabled = false; }
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(); }
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(); }
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" ); }
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(); }