protected override void OnStateLogicInit(NpcInfo npc, AiCommandDispatcher aiCmdDispatcher, long deltaTime) { NpcAiStateInfo info = npc.GetAiStateInfo(); info.Time = 0; npc.GetMovementStateInfo().IsMoving = false; info.HomePos = npc.GetMovementStateInfo().GetPosition3D(); info.Target = 0; }
protected override bool ExecCommand(StoryInstance instance, long delta) { Scene scene = instance.Context as Scene; if (null != scene) { if (m_ParamNum >= 3) { float x = m_X.Value; float y = m_Y.Value; float z = m_Z.Value; LogSystem.Info("CameraLookat:{0} {1} {2}", x, y, z); ArkCrossEngineMessage.Msg_RC_CameraLookat msg = new ArkCrossEngineMessage.Msg_RC_CameraLookat(); msg.x = x; msg.y = y; msg.z = z; msg.is_immediately = false; scene.NotifyAllUser(msg); } else if (m_ParamNum >= 1) { int unitId = m_UnitId.Value; NpcInfo npc = scene.SceneContext.GetCharacterInfoByUnitId(unitId) as NpcInfo; if (null != npc) { MovementStateInfo msi = npc.GetMovementStateInfo(); LogSystem.Info("CameraLookat:{0}({1} {2} {3})", unitId, msi.PositionX, msi.PositionY, msi.PositionZ); ArkCrossEngineMessage.Msg_RC_CameraLookat msg = new ArkCrossEngineMessage.Msg_RC_CameraLookat(); msg.x = msi.PositionX; msg.y = msi.PositionY; msg.z = msi.PositionZ; msg.is_immediately = false; scene.NotifyAllUser(msg); } } else { for (LinkedListNode <UserInfo> linkNode = scene.UserManager.Users.FirstValue; null != linkNode; linkNode = linkNode.Next) { UserInfo info = linkNode.Value; User user = info.CustomData as User; if (null != info && null != user) { MovementStateInfo msi = info.GetMovementStateInfo(); LogSystem.Info("CameraLookat:{0}({1} {2} {3})", info.GetId(), msi.PositionX, msi.PositionY, msi.PositionZ); ArkCrossEngineMessage.Msg_RC_CameraLookat msg = new ArkCrossEngineMessage.Msg_RC_CameraLookat(); msg.x = msi.PositionX; msg.y = msi.PositionY; msg.z = msi.PositionZ; msg.is_immediately = false; user.SendMessage(msg); } } } } return(false); }