コード例 #1
0
        public override void OnStateEnter()
        {
            base.OnStateEnter();

            _entityMovement.MoveToPosition(_position);
            _owner.GetCharacterComponent <EntityTransitiveStop>().EnableTransitiveStop();
        }
コード例 #2
0
        private void OnPathInvalidated()
        {
            var tilePositionNextToTree = ((TreeTileMapObject)pathfindingTileMap.tileMapManipulator.GetTileMapObjectWithTileMapCoordinates(targetPosition)).GetTilePositionNextToTree();

            if (tilePositionNextToTree != new Vector2(-1, -1))
            {
                entityMovement.MoveToPosition(pathfindingTileMap.MapToWorld(tilePositionNextToTree), isPlayer: true, paramsToReturn: new object[] { }, targetCannotBeReachedParamsToReturn: new object[] { GetOwner <Player>() });
            }
            else
            {
                GetStateMachine <PlayerStateMachine>().TransitionTo(GetStateMachine <PlayerStateMachine>().idle);
            }
        }
コード例 #3
0
        private void OnPathInvalidated() {
            var tileMapObjectWithTileMapCoordinates = pathfindingTileMap.tileMapManipulator.GetTileMapObjectWithTileMapCoordinates(pathfindingTileMap.WorldToMap(targetPosition));
            if (tileMapObjectWithTileMapCoordinates is TreeTileMapObject treeTileMapObject) {
                var tilePositionNextToTree = treeTileMapObject.GetTilePositionNextToTree();
                if (tilePositionNextToTree != new Vector2(-1, -1)) {
                    entityMovement.MoveToPosition(pathfindingTileMap.MapToWorld(tilePositionNextToTree), isPlayer: false, paramsToReturn: new object[] { }, targetCannotBeReachedParamsToReturn: new object[] {GetOwner<Demon>()});
                    return;
                }
            }

            GetStateMachine<DemonStateMachine>().TransitionTo(GetStateMachine<DemonStateMachine>().idle);
            GetNode<Eventing>(Eventing.EventingNodePath).EmitSignal(nameof(Eventing.TargetCannotBeReached), GetOwner<Demon>());
        }
コード例 #4
0
 private void OnPathInvalidated()
 {
     entityMovement.MoveToPosition(targetPosition, isPlayer: false, paramsToReturn: new object[] { }, targetCannotBeReachedParamsToReturn: new object[] { GetOwner <Demon>() });
 }
コード例 #5
0
ファイル: ActionPatrol.cs プロジェクト: Theo-Farnole/Tartaros
        private void MoveToPosition(bool goToTarget)
        {
            Vector3 position = goToTarget ? _targetPosition : _startingPosition;

            _entityMovement.MoveToPosition(position);
        }