public override bool Execute() { //if (IsEnabled) { SM.SceneRoom room = SM.RandomRoomLevel.Singleton.LookupRoom(RoomGUID); foreach (var trapData in mTrapDataList) { Actor trapActor = null;// GetTrapActor(trapData.mTrapType);//room.GetTrapByID(trapData.mTrapId); switch (trapData.mTrapType) { case ENTrapType.enSpecial: trapActor = room.GetTrapByID(trapData.mTrapId); break; default: break; } if (trapActor == null) { return(false); } Trap trap = trapActor as Trap; trap.SetTrapState(trapData.mTrapState); } } return(true); }
public override void Tick() { base.Tick(); SM.SceneRoom room = SM.RandomRoomLevel.Singleton.LookupRoom(RoomId); if (null != room) { foreach (var item in mEventTrapDataList) { Actor tmpActor = room.GetTrapByID(item.mTrapId); if (null != tmpActor) { Trap trap = tmpActor as Trap; if (trap.mTrapState == item.mTrapState) { IsEnabled = true; } } } } }