protected override void SetupCharacter() { tag = "Enemy"; isPlayMode = true; base.SetupCharacter(); strSwither = new StrategySwithcer(); startPosition = transform.localPosition; isSmart = brainWeight >= Random.Range(45f, 75f); ICommand speedCMD = new ChangeAnimationSpeedCommand(this, SpeedStatus.NormalSpeed); speedCMD.Execute(); currentTarget = GameController.Instance.characterModule.player; // test targetTransform = currentTarget.transform; //test if (currentAttackType == AttackType.Melee) { attackDistance = navigationController.GetAgentStopDistance(); //only if malee attack type; } else { animationController.SetRangeAnimation(); } SetupStrategy(); StartCoroutine(CheckTargetDistance()); }
private void StopMoveToPoint() { ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.NormalSpeed); speedCMD.Execute(); stateMachine.ChangeState(typeof(Idle)); }
public float attackDistance;//??? EnemyCharacter protected override void SetupCharacter() { base.SetupCharacter(); attackDistance = navigationController.GetAgentStopDistance();//if only melee attack type ICommand speedCMD = new ChangeAnimationSpeedCommand(this, SpeedStatus.RunSpeed); speedCMD.Execute(); }
private void EndMove() { ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.NormalSpeed); speedCMD.Execute(); owner.StatusController.isHunting = false; owner.StatusController.isRetreat = false; stateMachine.ChangeState(typeof(Idle)); }
private void StartMove() { ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.ExtraRunSpeed); speedCMD.Execute(); owner.StatusController.isRetreat = true; owner.NavigationController.SetCurrentPoint(enemy.startPosition); stateMachine.ChangeState(typeof(Move)); }
public override void DoStrategy() { base.DoStrategy(); if (!owner.StatusController.isHunting) { ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.RunSpeed); speedCMD.Execute(); } if (owner.StatusController.isCombat) { return; } SetPlayerPosition(); }
private void SetRetreatPoint() { Vector3 direction = (enemy.targetTransform.position + enemyTransform.position).normalized; _point = enemyTransform.position + direction * enemy.visionRadius * 1.5f; owner.NavigationController.SetCurrentPoint(_point); ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.ExtraRunSpeed); speedCMD.Execute(); owner.StatusController.isRetreat = true; owner.StatusController.isHunting = false; _lastTimeRetreat = Time.time + 120f; stateMachine.ChangeState(typeof(Move)); }