/// <summary> /// Show or otherwise handle the door opening. /// </summary> virtual protected void DoOpen(Character character) { state = DoorState.OPEN; OnOpened(character); // If we have a persistable object attached set the state. PersistableObject po = GetComponent <PersistableObject> (); if (po != null) { po.SetState(true); } }
/// <summary> /// Show or otherwise handle the door closing. /// </summary> virtual protected void DoClose(Character character) { state = DoorState.CLOSED; OnClosed(character); // If we have a persistable object attached set the state. PersistableObject po = GetComponent <PersistableObject> (); if (po != null) { po.SetState(false); } }
/// <summary> /// Do the collection. /// </summary> /// <param name="character">Character doing the collection.</param> virtual protected void DoCollect(Character character) { ItemManager itemManager = character.GetComponentInChildren <ItemManager> (); if (itemManager != null) { itemManager.CollectItem(this); } DoEventForCollect(character); // If we have a persistable object attached set the state. PersistableObject po = GetComponent <PersistableObject> (); if (po != null) { po.SetState(false); } }
/// <summary> /// Raises the deactivated event. /// </summary> /// <param name="character">Character causing deactivation, can be null.</param> virtual protected void OnPlatformDeactivated(IMob character) { if (PlatformDeactivated != null) { if (character is Character) { characterEventArgs.Update((Character)character); } else { characterEventArgs.Update(null); } PlatformDeactivated(this, characterEventArgs); } // If we have a persistable object attached set the state. PersistableObject po = GetComponent <PersistableObject> (); if (po != null) { po.SetState(false); } }