protected override void CheckOperate() { base.CheckOperate(); if (PeInput.Get(PeInput.LogicFunction.InteractWithItem) && CanCmd()) { if (EntityMonsterBeacon.IsRunning()) { PeTipMsg.Register(PELocalization.GetString(8000596), PeTipMsg.EMsgLevel.Warning); return; } if (!Operatable()) { return; } Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt; if (null != operateCmpt && operateCmpt.HasOperate) { return; } Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.motionMgr; if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep))) { return; } GameUI.Instance.mItemOp.ShowSleepWnd(true, this, bedView.peSleep, Pathea.MainPlayer.Instance.entity); // GameUI.Instance.mItemOp.SleepImmediately(bedView.peSleep, Pathea.MainPlayer.Instance.entity); } }
bool CheckMonsterBeaconEnable() { ItemScript_MonsterBeacon monsterBeacon = GetComponent <ItemScript_MonsterBeacon>(); if (null != monsterBeacon && EntityMonsterBeacon.IsRunning()) { PeTipMsg.Register(PELocalization.GetString(82201076), PeTipMsg.EMsgLevel.Warning); return(false); } return(true); }
protected override void InitCmd(CmdList cmdList) { cmdList.Add("Turn", Turn90Degree); cmdList.Add("Get", OnGetBtn); //if (!GameConfig.IsMultiMode) { if (bedView.peSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep)) { cmdList.Add("Sleep", () => { if (EntityMonsterBeacon.IsRunning()) { PeTipMsg.Register(PELocalization.GetString(8000596), PeTipMsg.EMsgLevel.Warning); return; } if (!bedView.peSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep)) { return; } Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt; if (null != operateCmpt && operateCmpt.HasOperate) { return; } Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.GetCmpt <Pathea.MotionMgrCmpt>(); if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep))) { return; } //if (GameConfig.IsMultiMode) // GameUI.Instance.mItemOp.SleepImmediately(bedView.peSleep, Pathea.MainPlayer.Instance.entity); //else GameUI.Instance.mItemOp.ShowSleepWnd(true, this, bedView.peSleep, Pathea.MainPlayer.Instance.entity); }); } } }
void Update() { if (MonsterSiegeBasePause || PeGameMgr.IsMulti || EntityMonsterBeacon.IsRunning() || PeGameMgr.IsBuild) { return; } if (assembly == null || assembly.m_Entity == null || !(assembly.m_Entity is CSAssembly)) { return; } Init(); if (_lvl > 0 && m_Beacon == null) { lvl = 0; } if (m_Timer.Hour - _lastHour >= _nextHour) { CalculateLvl(); } }
public override void OnGetBtn() { //base.OnGetBtn (); //if (!GameConfig.IsMultiMode) //{ CSEntityObject ceo = GetComponent <CSEntityObject>(); if (ceo == null) { return; } if (EntityMonsterBeacon.IsRunning()) { PeTipMsg.Register(PELocalization.GetString(8000622), PeTipMsg.EMsgLevel.Warning); CloseOn(); return; } if (ceo.m_Entity.BaseData.m_Durability < ceo.m_Entity.m_Info.m_Durability * 0.15f) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000084)); } else { if (ceo as CSDwellingsObject != null) { MessageBox_N.ShowYNBox(PELocalization.GetString(8000085), GetOn, CloseOn); } else { MessageBox_N.ShowYNBox(PELocalization.GetString(8000086), GetOn, CloseOn); } } //} }
void Update() { if (PeCreature.Instance.mainPlayer == null || UITowerInfo.Instance == null) { return; } if (m_RecordTown != null) { m_Town = m_RecordTown; SetSiegeID(m_RecordTown.ms_id); m_RecordTown = null; } if (m_MonsterSiege != null && m_SpawnFinished && m_UIData.CurCount == m_UIData.MaxCount) { GameObject.DestroyImmediate(m_MonsterSiege.gameObject); } if (m_CurSiegeID > 0 && m_MonsterSiege == null) { m_CurSiegeID = 0; m_SpawnFinished = false; if (m_Town != null) { m_Town.SetMsId(0); } } if (m_IsReady) { m_ElapsedTime += Time.deltaTime; } if (m_MonsterSiege != null && m_MonsterSiege.SpData._timeToDelete > PETools.PEMath.Epsilon) { float remainTime = Mathf.Max(0.0f, m_MonsterSiege.SpData._timeToDelete - m_ElapsedTime); if (m_UIData != null) { m_UIData.RemainTime = remainTime; } if (remainTime <= PETools.PEMath.Epsilon) { m_MonsterSiege.Delete(); } } if (!EntityMonsterBeacon.IsRunning() && m_CurSiegeID == 0 && m_MonsterSiege == null) { m_Town = VArtifactTown.GetStandTown(PeCreature.Instance.mainPlayer.position); if (m_Town != null) { if (m_Town.lastHour < PETools.PEMath.Epsilon || m_Town.nextHour < PETools.PEMath.Epsilon) { m_Town.RandomSiege(minHour, maxHour); } #if false if (Input.GetKey(KeyCode.L)) { m_Town.lastHour = 0; m_Town.lastCheckTime = 0; probability = 1.1f; } #endif if (GameTime.Timer.Hour - m_Town.lastHour >= m_Town.nextHour) { if (Time.time - m_Town.lastCheckTime >= perCheckTime) { if (Random.value < probability) { SetSiegeID(GetLevel(m_Town)); m_Town.RandomSiege(minHour, maxHour); } m_Town.lastCheckTime = Time.time; } } } } }
void Update() { actionTime -= Time.deltaTime; timeCount += GameTime.DeltaTime; if (timeCount >= maxSleepTime || (isMainPlayer && actionTime < 0 && (PeInput.Get(PeInput.LogicFunction.InteractWithItem) || EntityMonsterBeacon.IsRunning()))) { if (peSleep != null) { peSleep.StopOperate(character, EOperationMask.Sleep); // peSleep.UnDo(character); } enabled = false; } }