コード例 #1
0
        protected override int OnTakeTurn(Entity actor)
        {
            int2 move = (int2)(_moveAction.triggered ? (float2)_moveAction.ReadValue <Vector2>() : float2.zero);

            int cost = Energy.ActionThreshold;

            if ((_previousMove.x == move.x && _previousMove.y == move.y) ||
                (move.x == 0 && move.y == 0))
            {
                cost = 0;
            }
            else
            {
                _moveSystem.TryMove(actor, move);
            }

            if (_quitAction.triggered)
            {
                Application.Quit();
            }

            _previousMove = move;


            return(cost);
        }
コード例 #2
0
        protected override int OnTakeTurn(Entity e)
        {
            var dir = GetRandomDirection(ref _rand);

            _moveSystem.TryMove(e, dir);

            return(Energy.ActionThreshold);
        }