Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        private void StopMoveToPoint()
        {
            ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.NormalSpeed);

            speedCMD.Execute();
            stateMachine.ChangeState(typeof(Idle));
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        private void EndMove()
        {
            ICommand speedCMD = new ChangeAnimationSpeedCommand(enemy, SpeedStatus.NormalSpeed);

            speedCMD.Execute();

            owner.StatusController.isHunting = false;
            owner.StatusController.isRetreat = false;
            stateMachine.ChangeState(typeof(Idle));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
        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));
        }