Пример #1
0
        /// <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);
            }
        }
Пример #2
0
        /// <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);
            }
        }
Пример #3
0
        /// <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);
            }
        }
Пример #4
0
        /// <summary>
        /// Init this door.
        /// </summary>
        override protected void Init()
        {
            PersistableObject po = GetComponent <PersistableObject> ();

            // No persistable lets set a default state
            if (po == null)
            {
                if (startOpen)
                {
                    state = DoorState.OPEN;
                }
                else
                {
                    state = DoorState.CLOSED;
                }
            }
            conditions = GetComponents <AdditionalCondition> ();
        }
Пример #5
0
        /// <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);
            }
        }