void CreateMonsterBeacon() { if (_lvl > 0 && assembly != null && assembly.m_Entity != null) { if (m_Beacon != null) { m_Beacon.Delete(); } m_UIData = new TowerInfoUIData(); m_Beacon = EntityMonsterBeacon.CreateMonsterBeaconByTDID(_lvl, transform, m_UIData); m_Beacon.gameObject.AddComponent <MonsterSiege>().SetCreator(assembly.m_Entity.m_Creator as CSMgCreator, m_UIData); } }
void Update() { m_Entities = m_Entities.FindAll(ret => ret != null && !ret.IsDeath()); if (!m_IsReady) { m_ElapsedTime += Time.deltaTime; } if (m_Beacon != null && m_Beacon.SpData._timeToDelete > PETools.PEMath.Epsilon) { m_RemainTime = m_Beacon.SpData._timeToDelete - m_ElapsedTime; if (m_RemainTime <= PETools.PEMath.Epsilon) { m_Beacon.Delete(); } } if (m_UIData != null) { m_UIData.CurCount = m_KillCount; m_UIData.MaxCount = m_MaxCount; if (m_RemainTime > -PETools.PEMath.Epsilon) { m_UIData.RemainTime = m_RemainTime; } } }
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; } } } } }