Esempio n. 1
0
        public void RemoveTing(string pName)
        {
            Ting tingToRemove = GetTing(pName);

            tingToRemove.table.RemoveRowAt(tingToRemove.objectId);
            tingToRemove.isDeleted = true;
            _tings.Remove(pName);
        }
Esempio n. 2
0
 public void RemoveOccupant(Ting pTing)
 {
     //D.assert(HasOccupants(), "No occupants");
     if (_occupants != null && _occupants.Contains(pTing))
     {
         _occupants.Remove(pTing);
     }
 }
Esempio n. 3
0
        public override bool CanInteractWith(Ting pTingToInteractWith)
        {
            /*var computer = pTingToInteractWith as Computer;

            if (computer != null && computer.hasFloppyAPI) {
                return true;
            }*/

            return pTingToInteractWith is Locker || pTingToInteractWith is TrashCan || pTingToInteractWith is SendPipe || pTingToInteractWith is Stove;
        }
Esempio n. 4
0
 private void AddTing(Ting t)
 {
     if (!_tings.ContainsKey(t.name))
     {
         _tings.Add(t.name, t);
     }
     else
     {
         throw new TingDuplicateException(" can't have two tings with the same name: " + t.name);
     }
 }
Esempio n. 5
0
        public void StartAction(string pActionName, Ting pOtherObject, float pLengthUntilTrigger, float pActionLength)
        {
            string oldAction = actionName;

#if DEBUG
            logger.Log("Starting action '" + pActionName + "' at time " + _tingRunner.gameClock);
#endif
            actionName = pActionName;
            float aStartTime = _tingRunner.actionTime;
            actionStartTime   = aStartTime;
            actionEndTime     = aStartTime + pActionLength;
            actionTriggerTime = aStartTime + pLengthUntilTrigger;
            actionHasFired    = false;
            actionOtherObject = pOtherObject;
            if (onNewAction != null)
            {
                onNewAction(oldAction, pActionName);
            }
        }
Esempio n. 6
0
 public void StartAction(string pActionName, Ting pOtherObject, float pLengthUntilTrigger, float pActionLength)
 {
     string oldAction = actionName;
     #if DEBUG
     logger.Log("Starting action '" + pActionName + "' at time " + _tingRunner.gameClock);
     #endif
     actionName = pActionName;
     float aStartTime = _tingRunner.actionTime;
     actionStartTime = aStartTime;
     actionEndTime = aStartTime + pActionLength;
     actionTriggerTime = aStartTime + pLengthUntilTrigger;
     actionHasFired = false;
     actionOtherObject = pOtherObject;
     if(onNewAction != null) onNewAction(oldAction, pActionName);
 }
Esempio n. 7
0
 public void AddOccupant(Ting pTing)
 {
     EnsureOccapantList();
     _occupants.Add(pTing);
 }
Esempio n. 8
0
 protected virtual void ActionTriggered(Ting pOtherTing)
 {
 }
Esempio n. 9
0
 public virtual bool CanInteractWith(Ting pTingToInteractWith)
 {
     return false;
 }
Esempio n. 10
0
		public override string UseTingOnTingDescription (Ting pOtherTing)
		{
			if(pOtherTing is Locker && this.CanInteractWith(pOtherTing)) {
				return "put " + this.tooltipName + " into locker";
			}
			else if(pOtherTing is SendPipe && this.CanInteractWith(pOtherTing)) {
				return "put " + this.tooltipName + " into pipe";
			}
			else if(pOtherTing is TrashCan && this.CanInteractWith(pOtherTing)) {
				return "throw " + this.tooltipName + " into trash can";
			}

			return base.UseTingOnTingDescription (pOtherTing);
		}
Esempio n. 11
0
 public override bool CanInteractWith(Ting pTingToInteractWith)
 {
     return pTingToInteractWith is SendPipe || pTingToInteractWith is Stove;
 }
Esempio n. 12
0
 public MyTingShell(Ting pTing)
 {
     _ting = pTing;
     _ting.AddDataListener<string>("name", OnNameChanged);
 }
Esempio n. 13
0
 void OnTingHasNewRoom(Ting pTing, string pNewRoomName)
 {
     //D.Log("OnTingHasNewRoom in " + _computer + " happened with " + pTing + " and new room " + pNewRoomName);
     if(pNewRoomName == _computerRoomCache && !_computer.masterProgram.isOn) {
         //D.Log("OnIntruder in " + _computer + " will trigger with " + pTing.name + " in room " + pNewRoomName);
         _computer.masterProgram.maxExecutionTime = 10f;
         _computer.masterProgram.StartAtFunctionIfItExists ("OnIntruder", new object[] { pTing.name }, null);
     }
 }
Esempio n. 14
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. 15
0
        public override bool CanInteractWith(Ting pTingToInteractWith)
        {
            if (pTingToInteractWith == this) {
                return false;
            }

            if(
                pTingToInteractWith is Drink ||
                pTingToInteractWith is Character ||
                pTingToInteractWith is Bed ||
                pTingToInteractWith is Seat ||
                pTingToInteractWith is MysticalCube ||
                pTingToInteractWith is Door ||
                pTingToInteractWith is Lamp ||
                pTingToInteractWith is Teleporter ||
                pTingToInteractWith is Extractor ||
                pTingToInteractWith is Radio ||
                pTingToInteractWith is MusicBox ||
                pTingToInteractWith is Portal ||
                pTingToInteractWith is Drug ||
                pTingToInteractWith is Computer ||
                pTingToInteractWith is TrashCan ||
                pTingToInteractWith is FuseBox ||
                pTingToInteractWith is Hackdev ||
                pTingToInteractWith is CreditCard ||
                pTingToInteractWith is Button ||
                pTingToInteractWith is Point ||
                pTingToInteractWith is Goods ||
                pTingToInteractWith is Robot ||
                pTingToInteractWith is Key ||
                pTingToInteractWith is Machine ||
                pTingToInteractWith is Sink ||
                pTingToInteractWith is Tv ||
                pTingToInteractWith is Fountain ||
                pTingToInteractWith is Floppy ||
                pTingToInteractWith is Locker ||
                pTingToInteractWith is Jewellery ||
                pTingToInteractWith is Stove ||
                pTingToInteractWith is FryingPan ||
                pTingToInteractWith is SendPipe ||
                pTingToInteractWith is Fence ||
                pTingToInteractWith is Tram ||
                pTingToInteractWith is Screwdriver ||
                pTingToInteractWith is Map ||
                pTingToInteractWith is VendingMachine ||
                pTingToInteractWith is Telephone ||
                pTingToInteractWith is Taser ||
                pTingToInteractWith is Pawn ||
                pTingToInteractWith is Memory
                )
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 16
0
 private void FaceTing(Ting pTing)
 {
     direction = (pTing.position.localPosition - localPoint).ToDirection();
 }
Esempio n. 17
0
        protected override void ActionTriggered(Ting pOtherTing)
        {
            if (actionName == "Drinking") {
                Drink drink = (Drink)pOtherTing;
                D.isNull(drink, "drink is null");
                drink.DrinkFrom (this);
            } else if (actionName == "TakingDrug" || actionName == "Eat") {
                Drug drug = (Drug)pOtherTing;
                D.isNull(drug, "drug is null");
                drug.Take (this);
                actionOtherObject = null;
                SetNoHandItem ();
                _dialogueRunner.EventHappened (name + "_took_" + drug.name);
                _tingRunner.RemoveTingAfterUpdate (drug.name);
            } else if (actionName == "TakingSnus") {
                var snus = pOtherTing as Snus;
                D.isNull(snus, "snus is null");
                snus.Take (this);
                _dialogueRunner.EventHappened (name + "_snusade");
            } else if (actionName == "SmokingCigarette") {
                var cigarette = pOtherTing as Cigarette;
                D.isNull(cigarette, "cigarette is null");
                cigarette.Take (this);
            } else if (actionName == "LockedDoor") {
                _worldSettings.Notify (name, "The door is locked");
                D.isNull(pOtherTing, "pOtherTing is null");
                _dialogueRunner.EventHappened (name + "_yank_" + pOtherTing.name);
            } else if (actionName == "UseDoorReallySoon") {
                D.Log(name + " is triggering UseDoorReallySoon: " + pOtherTing.name);
                var theDoor = (pOtherTing as Door);
                if(theDoor.autoLockTimer <= 0f && ArePointsWithinDistance(localPoint, theDoor.waitingPoint, 1)) {
                    StopAction();
                    InteractWith(pOtherTing);
                }
                else {
                    _worldSettings.Notify(name, "Door was just locked");
                }
            } else if (actionName == "WalkingThroughDoor") {
                Door door = pOtherTing as Door;
                D.isNull(door, "door is null");
                door.WalkThrough (this);
                door.targetDoor.Open (); // mid point
            } else if (actionName == "WalkingThroughDoorPhase2") {
                //D.Log (name + " is done with walk through door phase 2!");
                StopAction ();
                if (_walkBehaviour != null) {
                    _walkBehaviour.StartWalkingAgain ();
                }
            } else if (actionName == "WalkingThroughPortal") {
                Portal portal = pOtherTing as Portal;
                D.isNull(portal, "portal is null");
                portal.WalkThrough (this);
            } else if (actionName == "WalkingThroughPortalPhase2") {
                //D.Log(name + " is done with walk through portal phase 2!");
                StopAction ();
                if (_walkBehaviour != null) {
                    _walkBehaviour.StartWalkingAgain ();
                }
            } else if (actionName == "WalkingThroughFence") {
                //StopAction ();
                StartAction ("DoneWalkingThroughFence", null, 0.01f, 0.02f);
                var fence = (pOtherTing as Fence);
                D.isNull(fence, "fence is null");
                position = fence.goalPosition;
                fence.user = null;
                timetableTimer = 0f; // re-trigger timetable
            } else if (actionName == "UsingDoorWithKey") {
                var door = pOtherTing as Door;
                D.isNull(door, "door is null");

                var key = (handItem as Key);
                if(key == null) {
                    D.Log(name + " is UsingDoorWithKey but has no key in hand, will interact normally with it instead.");
                    InteractWith(door);
                    return;
                }

                key.InteractWith (door);
                #if LOG
                //logger.Log (name + " unlocked the door " + pOtherTing.name + " using the key '" + handItem.name + "'");
                #endif
            } else if (actionName == "PickingUp") {
                if (pOtherTing.isBeingHeld) {
                    #if LOG
                    logger.Log (pOtherTing + " is being held and can't be picked up");
                    #endif
                    return;
                }
                D.isNull(pOtherTing, "pOtherTing is null");
                SetHandItem ((MimanTing)pOtherTing);
                _dialogueRunner.EventHappened (name + "_pickup_" + pOtherTing.name);
                handItem.isBeingHeld = true;
            } else if (actionName == "Dropping" || actionName == "DroppingFar") {
                if(handItem == null) {
                    D.Log (name + " is trying to drop hand item but it is null");
                    return;
                }
                int dropLength = (actionName == "Dropping") ? 1 : 2;
                var dropTarget = new WorldCoordinate (room.name, localPoint + IntPoint.DirectionToIntPoint (direction) * dropLength);
                handItem.position = dropTarget;
                handItem.isBeingHeld = false;
                handItem.direction = direction;
                handItem.OnPutDown ();
                SetNoHandItem ();
            } else if (actionName == "PutHandItemIntoInventory") {
                MoveHandItemToInventory ();
            } else if (actionName == "TakeOutInventoryItem") {
                SetHandItem ((MimanTing)pOtherTing);
                handItem.position = position;
                handItem.isBeingHeld = true;
            } else if (actionName == "LayingDown") {
                D.isNull(bed, "bed is null");
                LayInBed (bed);
            } else if (actionName == "FallingAsleep") {
                int hours = 8;
                if(!isAvatar) {
                    hours = 3; // TODO: do this to make people not sleep as long and miss stuff
                }
                Sleep (gameClock + new GameTime (hours, 0));
            } else if (actionName == "FallingAsleepInChair") {
                Sleep (gameClock + new GameTime (3, 0));
            } else if (actionName == "FallAsleepFromStanding") {
                // Alarm time is set when FallAsleepFromStanding() is called
                Sleep (alarmTime);
                laying = true;
            } else if (actionName == "GettingSeated") {
                var seat = pOtherTing as Seat;
                D.isNull(seat, "seat is null");
                Sit (seat);
            } else if (actionName == "GettingUpFromSeat") {
                //D.Log("GettingUpFromSeat action triggered the normal way");
                AfterGettingUpFromSeat ();
                if (seat != null) {
                    GetUpSeatSnap ();
                }
            } else if (actionName == "GettingUpFromBed") {
                //D.Log("GettingUpFromBed action triggered the normal way");
                AfterGettingUpFromBed ();
                if (bed != null) {
                    GetUpBedSnap ();
                }
            } else if (actionName == "PushingButtonOnHandItem" || actionName == "StartingJukebox") {
                D.Log ("Triggering action " + actionName);
                TingWithButton tingWithButton = pOtherTing as TingWithButton;
                D.isNull(tingWithButton, "tingWithButton is null");
                if (tingWithButton == null) {
                    D.LogError (pOtherTing.name + " is not a TingWithButton");
                }
                tingWithButton.PushButton (this);
            } else if (actionName == "PushingButton") {
                var button = (pOtherTing as Button);
                D.isNull(button, "button is null");
                button.Push (this);
                _dialogueRunner.EventHappened (this.name + "_pressed_" + pOtherTing.name);
            } else if (actionName == "UsingTv") {
                var tv = (pOtherTing as Tv);
                D.isNull(tv, "tv is null");
                tv.Flip ();
            } else if (actionName == "TurnLeft") {
                TurnDegrees (90);
            } else if (actionName == "TurnRight") {
                TurnDegrees (-90);
            } else if (actionName == "KickingLamp") {
                Lamp lamp = pOtherTing as Lamp;
                D.isNull(lamp, "lamp is null");
                lamp.Kick ();
            } else if (actionName == "Extracting") {
                Extractor extractor = handItem as Extractor;
                if (extractor == null) {
                    D.LogError (name + " is trying to use a hand item that is not an Extractor to extract things");
                } else {
                    extractor.Attach (pOtherTing);
                }
            } else if (actionName == "UsingComputer") {
                Computer computer = pOtherTing as Computer;
                D.isNull(computer, "computer is null");
                Floppy maybeFloppy = handItem as Floppy;
                computer.GetUsedBy (this, maybeFloppy);
                _dialogueRunner.EventHappened (name + "_start_Computer");
            } else if (actionName == "SlurpingIntoComputer") {
                StartAction ("InsideComputer", pOtherTing, LONG_TIME, LONG_TIME);
                _dialogueRunner.EventHappened (name + "_slurped_" + pOtherTing.name);
            } else if (actionName == "Inspect") {
                if (actionOtherObject is FuseBox) {
                    (actionOtherObject as FuseBox).BeInspected (this);
                    _dialogueRunner.EventHappened (name + "_inspect_Fusebox");
                } else if (actionOtherObject is Fountain) {
                    _dialogueRunner.EventHappened (name + "_inspect_Fountain");
                } else if (actionOtherObject is TrashCan) {
                    _dialogueRunner.EventHappened (name + "_inspect_TrashCan");
                }
            } else if (actionName == "ThrowingTingIntoTrashCan") {
                var trash = handItem;
                TrashCan trashCan = pOtherTing as TrashCan;
                D.isNull(trashCan, "trashCan is null");
                trashCan.Throw (trash);
            } else if (actionName == "PuttingTingIntoSendPipe") {
                var pipe = pOtherTing as SendPipe;
                D.isNull(pipe, "pipe is null");
                var stuff = handItem;
                handItem.isBeingHeld = false;
                SetNoHandItem ();
                pipe.PutStuffIntoIt (stuff);
            } else if (actionName == "PuttingTingIntoLocker") {
                Locker locker = pOtherTing as Locker;
                D.isNull(locker, "locker is null");
                handItem.isBeingHeld = false;
                bool success = locker.PutTingIntoRandomFreeSpot (handItem);
                if (success) {
                    SetNoHandItem ();
                }
            } else if (actionName == "GivingHandItem") {
                Character receiver = pOtherTing as Character;
                D.isNull (receiver, "The receiver is null");
                _dialogueRunner.EventHappened (name + "_give_"/* + handItem.prefab + "_to_" */ + receiver.name);
                if (onNewHandItem != null) {
                    onNewHandItem ("", true);
                }
                if (receiver.handItem != null) {
                    receiver.MoveHandItemToInventoryForcefully ();
                }
                receiver.SetHandItem (handItem);
                handItem = null;
            } else if (actionName == "BeingBothered") {
                timetableTimer = 0.5f;
            } else if (actionName == "Tasing") {
                var otherCharacter = (pOtherTing as Character);
                D.isNull(otherCharacter, "other character is null");
                otherCharacter.GetTased ();
                _dialogueRunner.EventHappened(name + "_tase_" + otherCharacter);
            } else if (actionName == "GettingTased") {
                ClearWalkingData(); // FIX?!
                FallAsleepFromStanding (2);
            } else if (actionName == "Angry") {
                timetableTimer = 0.5f;
            } else if (actionName == "UseSink") {
                var sink = (actionOtherObject as Sink);
                D.isNull(sink, "sink is null");
                sink.Toggle ();
                if (!sink.on) {
                    _dialogueRunner.EventHappened (name + "_turnOff_" + sink.name);
                }
            } else if (actionName == "RefillingDrink") {
                var drink = (handItem as Drink);
                D.isNull(drink, "drink is null");
                var sink = actionOtherObject as Sink;
                if (sink == null) {
                    D.Log ("Sink was null, can't refill");
                } else {
                    sink.UseDrinkOnSink (drink);
                }
            } else if (actionName == "Screwing") {
                var screwdriver = (handItem as Screwdriver);
                D.isNull(screwdriver, "screwdriver is null");
                var computer = actionOtherObject as Computer;
                if (computer == null) {
                    D.Log ("Computer was null, can't screw it");
                } else {
                    screwdriver.UseOnComputer (computer);
                }
            } else if (actionName == "Mixing") {
                var mixer = pOtherTing as MusicBox;
                D.isNull(mixer, "mixer is null");
                mixer.isPlaying = true;
            } else if (actionName == "UseStove") {
                var stove = pOtherTing as Stove;
                D.isNull(stove, "stove is null");
                stove.on = !stove.on;
            } else if (actionName == "TalkingInTelephone") {
                var phone = (pOtherTing as Telephone);
                D.isNull(phone, "phone is null");
                phone.Use ();
                _dialogueRunner.EventHappened (name + "_phone_" + pOtherTing.name);
            } else if (actionName == "ActivatingVendingMachine") {
                var vendingMachine = pOtherTing as VendingMachine;
                D.isNull(vendingMachine, "vendingMachine is null");
                vendingMachine.PushCokeDispenserButton (this);
            } else if (actionName == "Stealing") {
                var otherCharacter = actionOtherObject as Character;
                D.isNull(otherCharacter, "other character is null");
                var items = otherCharacter.inventoryItems;
                if (items.Length == 0) {
                    _worldSettings.Notify (name, "Nothing to steal");
                } else {
                    Ting stolenItem = Randomizer.RandNth (items);
                    MoveHandItemToInventory ();
                    SetHandItem (stolenItem as MimanTing);
                    _worldSettings.Notify (name, "You stole: " + stolenItem.tooltipName);
                }
            }
            else {
                //throw new Exception("Can't find trigger response to action '" + actionName + "'");
            }
        }
Esempio n. 18
0
        public void WalkToTingAndUseHandItem(Ting pOtherTing)
        {
            rememberToHackComputerAfterSittingDown = false;

            if (pOtherTing.HasInteractionPointHere (this.position)) {
                UseHandItemToInteractWith (pOtherTing);
                return;
            }

            PrepareForNewWalkBehaviour(pOtherTing.position, pOtherTing, WalkMode.WALK_TO_TING_AND_USE_HAND_ITEM);
        }
Esempio n. 19
0
 public override bool CanInteractWith(Ting pTingToInteractWith)
 {
     return false;
 }
Esempio n. 20
0
        public override void PrepareForBeingHacked()
        {
            // Accessing the getter to make sure that a program is generated
            if(masterProgram == null) { logger.Log("There was a problem generating the master program"); }

            _user = null;
        }
Esempio n. 21
0
        /// <summary>
        /// If the other ting is pickupable, the character will just pick it up and not do anything with it. 
        /// If the other ting is not pickupable, the character will interact directly with it using the InteractWith() function.
        /// </summary>
        public void WalkToTingAndInteract(Ting pOtherTing)
        {
            rememberToHackComputerAfterSittingDown = false;

            if(isAvatar && pOtherTing is Door) {
                Door door = pOtherTing as Door;
                if(door.isBusy) {
                    _worldSettings.Notify(name, "Door in use, will wait in line");
                    rememberToUseDoorAfterWaitingPolitely = door;
                    WalkTo (new WorldCoordinate(room.name, door.waitingPoint));
                    return;
                }
            }

            if (pOtherTing.HasInteractionPointHere (this.position)) {
                if (pOtherTing.canBePickedUp) {
                    logger.Log (name + " will pick up " + pOtherTing + " directly, no need to move");
                    PickUp (pOtherTing);
                } else {
                    logger.Log (name + " will interact directly with " + pOtherTing + ", no need to move");
                    InteractWith (pOtherTing);
                }
                return;
            }

            if(pOtherTing is Character && MimanGrimmApiDefinitions.AreTingsWithinDistance(this, pOtherTing, 10)) {
                Character otherCharacter = pOtherTing as Character;
                if(this.sitting || this.laying || otherCharacter.HasNoFreeInteractionPoints()) {
                    #if LOG
                    logger.Log(name + " is using direct interaction with " + otherCharacter);
                    #endif
                    InteractWith(pOtherTing);
                    return;
                }
            }

            PrepareForNewWalkBehaviour(pOtherTing.position, pOtherTing, WalkMode.WALK_TO_TING_AND_INTERACT);
        }
Esempio n. 22
0
 public void PushButton(Ting pUser)
 {
     _user = pUser;
     D.Log(name + " was activated!");
     masterProgram.Start();
 }
Esempio n. 23
0
 public virtual string UseTingOnTingDescription(Ting pOtherTing) {
     return "use " + tooltipName + " on " + pOtherTing.tooltipName;
 }
Esempio n. 24
0
 public void PushButton(Ting pUser)
 {
     masterProgram.Start();
 }
Esempio n. 25
0
		public float AddConnectionToTing (Ting pTing)
		{
			if (pTing == this) {
				//return "Can't connect to self"; // can't connect to self
				return -1f;
			}

			D.isNull (pTing, "Can't connect to null");
			string tingName = pTing.name;

			string[] oldTingNames = CELL_connectedTings.data;
			int index = 0;
			foreach (string name in oldTingNames) {
				if (tingName == name) {
					//return "Already connected to " + name; // already has a connection to this ting
					return (float)index;
				}
				index++;
			}
			
			string[] newTingNames = new string[oldTingNames.Length + 1];
			int i = 0;
			foreach(string name in oldTingNames) {
				newTingNames[i++] = name;
			}
			newTingNames[i] = tingName;
			CELL_connectedTings.data = newTingNames;

			//return "Connected successfully to " + tingName;
			return (float)i;
		}
Esempio n. 26
0
 public void Attach(Ting pTarget)
 {
     //D.Log(name + " attached to " + pTarget + " will run program with content " + masterProgram.sourceCodeContent);
     _target = pTarget as MimanTing;
     masterProgram.Start();
 }
Esempio n. 27
0
        public void TakeOutInventoryItem(Ting pTingInInventory)
        {
            if(pTingInInventory == this) {
                D.Log("Can't take out yourself from the inventory");
                return;
            }

            /* OLD (ALMOST CORRECT) CODE!
            bool success = true;

            pTingInInventory.position = new WorldCoordinate("Internet", 1000, 1000); // make room for a possible hand item (it's a swap)

            if(handItem != null) {
                success = MoveHandItemToInventory(); // now there is definitely room for the item since we removed one item
            }

            // put the item back into inventory so we don't lose it (it will be taken out now)
            pTingInInventory.position = new WorldCoordinate (inventoryRoomName, IntPoint.Zero); // put it back again since the swap failed

            if (success) {
                StartAction ("TakeOutInventoryItem", pTingInInventory, 0.5f, 1.0f);
            } else {
                _worldSettings.Notify(name, "Can't put away " + handItem.tooltipName);
            }*/

            // NEW SOLUTION: ALWAYS SUCCEED!

            if(handItem != null) {
                MoveHandItemToInventoryForcefully();
            }

            StartAction ("TakeOutInventoryItem", pTingInInventory, 0.5f, 1.4f);
        }
Esempio n. 28
0
 public override string UseTingOnTingDescription(Ting pOtherTing)
 {
     return "Extract from " + pOtherTing.tooltipName;
 }
Esempio n. 29
0
 public override bool CanInteractWith(Ting pTingToInteractWith)
 {
     return pTingToInteractWith is Character || pTingToInteractWith is Locker;
 }
Esempio n. 30
0
 public void PushButton(Ting pUser)
 {
     PlaySound("Button");
     onButtonProgram.Start();
 }
Esempio n. 31
0
 public virtual void InteractWith(Ting pTingToInteractWith)
 {
     throw new NotImplementedException();
 }
Esempio n. 32
0
 public virtual bool CanInteractWith(Ting pTingToInteractWith)
 {
     return(false);
 }
Esempio n. 33
0
 protected virtual void ActionTriggered(Ting pOtherTing)
 {
 }
Esempio n. 34
0
 public override void InteractWith(Ting pTingToInteractWith)
 {
     if(pTingToInteractWith is Sink) {
         amount = 100f;
     }
 }
Esempio n. 35
0
 public virtual void InteractWith(Ting pTingToInteractWith)
 {
     throw new NotImplementedException();
 }
Esempio n. 36
0
 public void PushButton(Ting pUser)
 {
     dialogueLine = "";
 }
Esempio n. 37
0
 public override bool CanInteractWith(Ting pTingToInteractWith)
 {
     return pTingToInteractWith is Sink || pTingToInteractWith is Locker || pTingToInteractWith is TrashCan || pTingToInteractWith is SendPipe || pTingToInteractWith is Stove;
 }
Esempio n. 38
0
        public void UseHandItemToInteractWith(Ting pTingToInteractWith)
        {
            if(pTingToInteractWith != handItem) {
                FaceTing(pTingToInteractWith);
            }

            if (handItem is Key && pTingToInteractWith is Door) {
                StartAction ("UsingDoorWithKey", pTingToInteractWith, 1.5f, 1.8f);
            } else if (pTingToInteractWith is Locker && handItem.CanInteractWith (pTingToInteractWith)) {
                StartAction ("PuttingTingIntoLocker", pTingToInteractWith, 0.5f, 1.2f);
            } else if (pTingToInteractWith != handItem && handItem is Extractor) {
                D.Log ("Using extractor on " + pTingToInteractWith);
                StartAction ("Extracting", pTingToInteractWith, 0.1f, 1.0f);
            } else if (pTingToInteractWith is SendPipe && handItem != null) {
                StartAction ("PuttingTingIntoSendPipe", pTingToInteractWith, 1.0f, 2.0f);
            } else if (pTingToInteractWith is TrashCan && handItem != null) {
                StartAction ("ThrowingTingIntoTrashCan", pTingToInteractWith, 0.9f, 1.6f);
            } else if (pTingToInteractWith is Sink && handItem is Drink) {
                (pTingToInteractWith as Sink).on = true;
                StartAction ("RefillingDrink", pTingToInteractWith, 0.5f, 1.2f);
            } else if (pTingToInteractWith is Stove && handItem != null) {
                (pTingToInteractWith as Stove).Fry (this, handItem);
            } else if (pTingToInteractWith is Character && handItem is Taser) {
                StartAction ("Tasing", pTingToInteractWith, 0.5f, 1.5f);
            } else if (pTingToInteractWith is Computer && handItem is Screwdriver) {
                StartAction ("Screwing", pTingToInteractWith, 0.5f, 1.2f);
            }
            else {
                StopAction();
            #if DEBUG
                D.Log(this.name + " at position " + this.position + " is trying to but can't interact using hand item '" + this.handItem + "' with target '" + pTingToInteractWith.name + "'");
            #endif
            }
        }