Exemple #1
0
        public override void OnStateEnter()
        {
            base.OnStateEnter();

            _entityMovement.MoveToPosition(_position);
            _owner.GetCharacterComponent <EntityTransitiveStop>().EnableTransitiveStop();
        }
Exemple #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);
            }
        }
        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>());
        }
 private void OnPathInvalidated()
 {
     entityMovement.MoveToPosition(targetPosition, isPlayer: false, paramsToReturn: new object[] { }, targetCannotBeReachedParamsToReturn: new object[] { GetOwner <Demon>() });
 }
        private void MoveToPosition(bool goToTarget)
        {
            Vector3 position = goToTarget ? _targetPosition : _startingPosition;

            _entityMovement.MoveToPosition(position);
        }