コード例 #1
0
        /// <summary>
        ///     移动到攻击范围内
        /// </summary>
        /// <param name="enemyDisplay"></param>
        private void MoveToAttackRange(ActionDisplay enemyDisplay)
        {
            Vector3 targetPoint = _meTransform.position;

            if (targetPoint.x < enemyDisplay.Controller.transform.position.x)
            {
                MeController.Me.ChangeDire(Directions.Right);
            }
            else
            {
                MeController.Me.ChangeDire(Directions.Left);
            }
            MeController.MoveByDir(MeController.Me.CurFaceDire);
        }
コード例 #2
0
        /// <summary>
        ///     没有怪物时的AI移动逻辑
        /// </summary>
        private void AiMoveBehaviourNoEnemy()
        {
            MapRange mapRange    = AppMap.Instance.mapParser.CurrentMapRange;
            Vector3  targetPoint = _meTransform.position;

            if (MapMode.CanGoToNextPhase)
            {
                MeController.Me.ChangeDire(Directions.Right);
                MeController.MoveByDir(MeController.Me.CurFaceDire);
                return;
            }
            if (targetPoint.x < mapRange.MinX + 1)
            {
                MeController.Me.ChangeDire(Directions.Right);
            }
            else if (targetPoint.x > mapRange.MaxX - 1)
            {
                MeController.Me.ChangeDire(Directions.Left);
            }
            MeController.MoveByDir(MeController.Me.CurFaceDire);
        }