public PersistenceFixture(IReferenceable refs, IConfigurable conf, IOpenable open, IClosable close, ICleanable clean, IWriter<Dummy, string> write, IGetter<Dummy, string> get, ISetter<Dummy> set) { Assert.NotNull(refs); _refs = refs; Assert.NotNull(conf); _conf = conf; Assert.NotNull(open); _open = open; Assert.NotNull(close); _close = close; Assert.NotNull(clean); _clean = clean; Assert.NotNull(write); _write = write; Assert.NotNull(get); _get = get; Assert.NotNull(set); _set = set; }
internal void Walk(Point point) { //Move Hero and open doors when bumped on Point destination = hero.Position + point; if (Map.ContainsKey(destination)) { if (Map[destination].Info.BlocksMove == true) { if (Map[destination] is IOpenable) { IOpenable d = Map[destination] as IOpenable; d.Open(); Map[destination].RemoveCellFromView(this[destination.X, destination.Y]); Map[destination].RenderToCell(this[destination.X, destination.Y]); UpdateFov(); } MessagesConsole.Instance.PrintMessage("Blocked Move!"); return; } // Handle render to new pos and unrendering from previous pos if (new Rectangle(0, 0, Width - 1, Height - 1).Contains(destination)) { hero.UnRenderFromCell(ActorLayer[hero.Position.X, hero.Position.Y]); hero.Position = destination; MessagesConsole.Instance.PrintMessage("You see here: " + Map[destination].Info.Description); UpdateFov(); hero.RenderToCell(ActorLayer[destination.X, destination.Y]); // Update Stats screen hero.OnChangedEvent(); } } }
protected void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag != "Player") { if (coll.gameObject.tag == "Floor") { audioSource.PlayOneShot(hitfloor, volumeScale); } else if (coll.gameObject.tag == "Wall") { audioSource.PlayOneShot(hitfloor, volumeScale); } dangerous = false; } IOpenable openable = coll.gameObject.GetComponent <IOpenable>(); IKillable killable = coll.gameObject.GetComponent <IKillable>(); if (openable != null) { audioSource.PlayOneShot(openDoor, 0.5f); openable.Open(); Destroy(gameObject); } if (killable != null && dangerous) { audioSource.PlayOneShot(hitPlayer, volumeScale); killable.Kill(); Destroy(gameObject); } }
void OnCollisionEnter2D(Collision2D coll) { IOpenable openable = coll.gameObject.GetComponent <IOpenable>(); if (openable != null) { openable.Open(); } }
void OnTriggerEnter2D(Collider2D col) { IOpenable openableCollidedWith = col.gameObject.GetComponent <IOpenable>(); if (openableCollidedWith != null) { openableCollidedWith.OnOpened(); remainingDuration--; } }
public override AcceptanceReport CanDesignateThing(Thing t) { IOpenable openable = t as IOpenable; if (openable == null || !openable.CanOpen || base.Map.designationManager.DesignationOn(t, Designation) != null) { return(false); } return(true); }
public void TryClose(IOpenable sender) { foreach (var i in MenuList) { if (!i.IsClosed && !sender.Equals(i)) { i.OpenOptions(); } } }
public void ToggleShouldOpen(IOpenable item) { // it's possible to click on the edge of the listview // and generate this event with a null item // in this case we ignore the click and return immediately if (item == null) { return; } item.ShouldOpen = !item.ShouldOpen; }
public static TargetingParameters ForOpen(Pawn p) { TargetingParameters targetingParameters = new TargetingParameters(); targetingParameters.canTargetPawns = false; targetingParameters.canTargetBuildings = true; targetingParameters.mapObjectTargetsMustBeAutoAttackable = false; targetingParameters.validator = delegate(TargetInfo x) { IOpenable openable = x.Thing as IOpenable; return(openable != null && openable.CanOpen); }; return(targetingParameters); }
public override AcceptanceReport CanDesignateThing(Thing t) { IOpenable openable = t as IOpenable; AcceptanceReport result; if (openable == null || !openable.CanOpen || base.Map.designationManager.DesignationOn(t, this.Designation) != null) { result = false; } else { result = true; } return(result); }
public override string ToString() { string str = GetType().Name + " is " + SwitchState; if (SwitchState == SwitchState.On) { if (this is IBass) { if ((this as IBass).BassState == BassState.On) { str += " Bass"; } } if (this is IOpenable) { IOpenable openable = this as IOpenable; if (openable != null) { str += " and " + openable.OpenState; } } if (this is IRecording) { if ((this as IRecording).RecordMode == RecordMode.Record) { str += " REC"; } } if (this is ITemperature) { str += " Current temperature " + (this as ITemperature).CurrentTemperature + "°C"; } if (this is IThreeDimensional) { if ((this as IThreeDimensional).Mode == TvMode.ThreeDMode) { str += " 3D"; } } if (this is IVolumeable) { str += " Volume " + (this as IVolumeable).CurrentVolume; } } return(str); }
static void OpenClose(IOpenable d) { if (d is IOpenable) { if (d.IsOpen) { d.Close(); } else { d.Open(); } } else { Console.WriteLine("not realizeted interface IOpenable"); } }
public static Toil Open(TargetIndex openableInd) { Toil open = new Toil(); open.initAction = delegate { Pawn actor = open.actor; Thing thing = actor.CurJob.GetTarget(openableInd).Thing; actor.Map.designationManager.DesignationOn(thing, DesignationDefOf.Open)?.Delete(); IOpenable openable = (IOpenable)thing; if (openable.CanOpen) { openable.Open(); actor.records.Increment(RecordDefOf.ContainersOpened); } }; open.defaultCompleteMode = ToilCompleteMode.Instant; return(open); }
// IOpenable public RedirectResult ToogleDoor(int id = 0) { if (id != 0) { Device device = db.GetDeviceById(id); if (device != null && device is IOpenable) { IOpenable door = (IOpenable)device; if (door.IsOpen) { door.Close(); } else { door.Open(); } db.UpdateDeviceById(id, device); } } return(Redirect("/Home/Index")); }
private void Start() { openable = openableObject.GetComponent <IOpenable>(); }
/*************************************************************************/ public void Dispose() { m_objOpenable.Close(); m_objOpenable = null; }
/*************************************************************************/ public Acquire(IOpenable objOpenable) { m_objOpenable = objOpenable; m_objOpenable.Open(); }
public IResult PerformCommand(IMobileObject performer, ICommand command) { if (command.Parameters.Count == 0) { return(new Result(false, "While you ponder what to open you let you mouth hang open. Hey you did open something!")); } IParameter parameter = command.Parameters[0]; IBaseObject foundItem = GlobalReference.GlobalValues.FindObjects.FindObjectOnPersonOrInRoom(performer, parameter.ParameterValue, parameter.ParameterNumber, true, true, false, false, true); if (foundItem != null) { IDoor door = foundItem as IDoor; if (door != null) { IResult result = ProcessDoor(performer, door); if (result != null) { return(result); } if (door.Linked) { IRoom otherRoom = GlobalReference.GlobalValues.World.Zones[door.LinkedRoomId.Zone].Rooms[door.LinkedRoomId.Id]; IDoor otherDoor = null; switch (door.LinkedRoomDirection) { case Direction.North: otherDoor = otherRoom.North.Door; break; case Direction.East: otherDoor = otherRoom.East.Door; break; case Direction.South: otherDoor = otherRoom.South.Door; break; case Direction.West: otherDoor = otherRoom.West.Door; break; case Direction.Up: otherDoor = otherRoom.Up.Door; break; case Direction.Down: otherDoor = otherRoom.Down.Door; break; } if (otherDoor != null) { otherDoor.Locked = false; otherDoor.Opened = true; } } return(door.Open()); } else { IOpenable openable = foundItem as IOpenable; if (openable != null) { return(openable.Open()); } } return(new Result(false, "You found what you were looking for but could not figure out how to open it.")); } else { return(new Result(false, "You were unable to find that what you were looking for.")); } }
static void OpenTheDoorByThe(IOpenable way) { way.Open(); }
/*************************************************************************/ public AsyncAcquire(IOpenable objOpenable) { m_objOpenable = objOpenable; }
public IResult PerformCommand(IMobileObject performer, ICommand command) { IResult result = base.PerfomCommand(performer, command); if (result != null) { return(result); } string message = null; if (!GlobalReference.GlobalValues.CanMobDoSomething.SeeDueToLight(performer)) { return(new Result("You can not see here because it is to dark.", true)); } if (command.Parameters.Count > 0) { string target = command.Parameters[0].ParameterValue; int targetNumber = command.Parameters[0].ParameterNumber; IBaseObject foundItem = GlobalReference.GlobalValues.FindObjects.FindObjectOnPersonOrInRoom(performer, target, targetNumber); if (foundItem != null) { if (foundItem as IPlayerCharacter != null) { message = BuildMobLookMessage(foundItem as IMobileObject, TagWrapper.TagType.PlayerCharacter); return(new Result(message, true)); } else if (foundItem as INonPlayerCharacter != null) { message = BuildMobLookMessage(foundItem as IMobileObject, TagWrapper.TagType.NonPlayerCharacter); return(new Result(message, true)); } else if (foundItem as IContainer != null) { IContainer container = foundItem as IContainer; StringBuilder strBldr = new StringBuilder(); strBldr.AppendLine(foundItem.LookDescription); IOpenable openable = container as IOpenable; if (openable != null) { if (openable.Opened) { foreach (IItem item in container.Items) { strBldr.AppendLine(item.ShortDescription); } } else { strBldr.AppendLine("<Closed>"); } } else { if (container.Items.Count == 0) { strBldr.AppendLine("<Empty>"); } else { foreach (IItem item in container.Items) { strBldr.AppendLine(item.ShortDescription); } } } message = GlobalReference.GlobalValues.TagWrapper.WrapInTag(strBldr.ToString().Trim(), TagWrapper.TagType.Item); return(new Result(message, true, null)); } else { message = GlobalReference.GlobalValues.TagWrapper.WrapInTag(foundItem.LookDescription, TagWrapper.TagType.Item); return(new Result(message, true)); } } return(new Result("Unable to find anything that matches that description.", true)); } else { return(LookAtRoom(performer)); } }
public static Open(this IOpenable obj) { // work on any concrete implementation of IOpenable }