Esempio n. 1
0
        private void PrepareForNewWalkBehaviour(WorldCoordinate pFinalTargetPosition, Ting pFinalTargetTing, WalkMode pWalkMode)
        {
            #if LOG
            logger.Log(name + " is preparing new walk behaviour with final target position " + pFinalTargetPosition);
            #endif

            if (pFinalTargetTing is Computer) {
                var tile = pFinalTargetTing.room.GetTile(pFinalTargetTing.interactionPoints[0]);
                if(tile != null) {
                    var chairInFrontOfComputer = tile.GetOccupantOfType<Seat>();
                    if(chairInFrontOfComputer != null) {
                        pFinalTargetTing = chairInFrontOfComputer;
                        pWalkMode = WalkMode.WALK_TO_TING_AND_INTERACT; // changes the intent of the player
                    }
                } else {
                    D.Log("Tile at interaction point for computer " + pFinalTargetTing + " is null, " + name + " can't walk there.");
                }
            }
            else if (pFinalTargetTing is Tram) {
                var tram = pFinalTargetTing as Tram;
                if(tram.movingDoor != null) {
                    //pFinalTargetTing = tram.movingDoor;
                    WalkToTingAndInteract (tram.movingDoor);
                    D.Log("Switched target for " + name + " from " + tram + " to " + tram.movingDoor);
                    return;
                }
            }

            if (pFinalTargetTing is Seat && pFinalTargetTing == this.seat) {
                #if LOG
                logger.Log(name + " can't sit on seat " + pFinalTargetTing + " since she/he is already doing that.");
                #endif
                return;
            }

            if (pFinalTargetTing is Bed && pFinalTargetTing == this.bed) {
                #if LOG
                logger.Log(name + " can't lay in bed " + pFinalTargetTing + " since she/he is already doing that.");
                #endif
                return;
            }

            finalTargetPosition = pFinalTargetPosition;
            finalTargetTing = pFinalTargetTing;
            walkMode = pWalkMode;
            walkIterator = 0;

            //			if (actionName == "GettingUpFromSeat" || actionName == "GettingUpFromBed") {
            //				return;
            //			} else if (actionName == "PickingUp" || actionName == "Dropping" || actionName == "DroppingFar") {
            //				return;
            //			}
            if (busy) {
                return;
            }
            else if (sitting) {
                if (seat != null) {
                    GetUpFromSeat ();
                    return;
                } else {
                    //D.Log("Just start walking (from sitting)");
                    sitting = false;
                }
            } else if (laying) {
                if (bed != null) {
                    GetUpFromBed ();
                    return;
                } else {
                    //D.Log ("Just start walking (from laying down)");
                    laying = false;
                }
            }

            _walkBehaviour = null;

            ClearConversationTarget();
            seat = null;
            bed = null;
        }
Esempio n. 2
0
 public void CreateNewWalkBehaviour()
 {
     //D.Log ("CreateNewWalkBehaviour()");
     _walkBehaviour = new SmartWalkBehaviour(this, _roomRunner, _tingRunner, _worldSettings);
 }
Esempio n. 3
0
 internal void ClearWalkingData()
 {
     walkMode = WalkMode.NO_TARGET;
     walkIterator = -1;
     targetPositionInRoom = WorldCoordinate.NONE;
     finalTargetPosition = WorldCoordinate.NONE;
     finalTargetTing = null;
     if(onRemovedPath != null) onRemovedPath();
     _walkBehaviour = null;
 }