Esempio n. 1
0
        public override void OnEnter()
        {
            Vector2Int startPos = Routine.First();
            Vector2Int endPos   = Routine.Last();

            Assert.IsFalse(startPos == endPos, "移动点和终结点相同");
            RPGCharacter ch = null;

            if (CharacterID >= 0)
            {
                ch = gameMode.ChapterManager.GetCharacterFromID(CharacterID);
                Assert.IsNotNull(ch, startPos + "处不存在角色");
                var chPos = ch.GetTileCoord();
                Assert.IsTrue(startPos == chPos, "ID:" + CharacterID + "  移动起始点" + startPos + "与角色所在位置" + chPos + "不相符");
            }
            else
            {
                ch = gameMode.ChapterManager.GetCharacterFromCoord(startPos);
                Assert.IsNotNull(ch, startPos + "处不存在角色");
            }
            ch.Logic.SetTileCoord(endPos);

            if (CameraFollow)
            {
                gameMode.slgCamera.StartFollowTransform(ch.GetTransform(), true);
            }

            if (WaitUntilFinished)
            {
                gameMode.BattlePlayer.MoveUnitByRoutine(Routine, ConstTable.UNIT_MOVE_SPEED(Speed), Continue);
            }
            else
            {
                gameMode.BattlePlayer.MoveUnitByRoutine(Routine, ConstTable.UNIT_MOVE_SPEED(Speed), null);
                Continue();
            }
        }
Esempio n. 2
0
    public void ExecuteMove(Vector2Int destPos)
    {
        Vector2Int srcPos = currentCharacter.GetTileCoord();

        CurrentCharacterLogic.SetTileCoord(destPos);
        CurrentCharacterLogic.ConsumeActionPoint(EnumActionType.Move);
        ChangeState(EBattleState.Lock);
        ClearRangeAction();
        gameMode.BattlePlayer.MoveUnitAfterAction(currentCharacter.GetCamp(), srcPos, destPos, ConstTable.UNIT_MOVE_SPEED(), CheckRangeEvent);
    }