public void DestroySelf() { RandomItemMgr.Instance.RemoveRandomItemObj(this); if (gameObj != null) { GameObject.Destroy(gameObj); } SceneMan.RemoveSceneObj(this); }
public void DestroySelf() { if (gameObj != null) { GameObject.Destroy(gameObj); } SceneMan.RemoveSceneObj(this); DungeonEntranceLabel.Remove(position); }
public static void DestroyAllInDungeon() { List <ISceneObjAgent> allItem = SceneMan.FindAllDragItemInDungeon(); for (int i = allItem.Count - 1; i >= 0; i--) { DragItemAgent.Destory(allItem[i] as DragItemAgent); } }
// HP 变化事件 protected virtual void OnHpChange(float deltaHp, bool isDead) { if (isDead) { DragItemAgent item = DragItemAgent.GetById(GetComponent <DragItemLogicCreation>().id); SceneMan.RemoveSceneObj(item); ItemAsset.ItemMgr.Instance.DestroyItem(itemObject); } }
// Start is called before the first frame update void Start() { if (I != null && I != this) { Destroy(gameObject); return; } I = this; GlobalState.I = _state; AudioReactiveManager.I.Bpm = _state.Bpm; _main = SceneManager.GetSceneByName("main"); if (!_main.IsValid()) { SceneManager.LoadScene("main", LoadSceneMode.Additive); } else { LoadedCoroutine(_main); } _logo = SceneManager.GetSceneByName("logo"); if (!_logo.IsValid()) { SceneManager.LoadScene("logo", LoadSceneMode.Additive); } else { LoadedCoroutine(_logo); } _boids = SceneManager.GetSceneByName("boids"); if (!_boids.IsValid()) { SceneManager.LoadScene("boids", LoadSceneMode.Additive); } else { LoadedCoroutine(_boids); } SceneManager.sceneLoaded += Loaded; // displays Debug.Log("displays connected: " + Display.displays.Length); // Display.displays[0] is the primary, default display and is always ON. // Check if additional displays are available and activate each. if (Display.displays.Length > 1) { Display.displays[1].Activate(); } Display.displays[0].SetRenderingResolution(1920, 1080); //if (Display.displays.Length > 2) { // Display.displays[2].Activate(); //} }
public void CreateDoodadAgents(Dictionary <int, DoodadSpawnPoint> points) { foreach (KeyValuePair <int, DoodadSpawnPoint> kvp in points) { SceneStaticAgent agent = new SceneStaticAgent(kvp.Value, true); agent.ScenarioId = kvp.Value.ID; kvp.Value.agent = agent; SceneMan.AddSceneObj(agent); } }
public void CreateNpcAgents(Dictionary <int, NPCSpawnPoint> points) { foreach (KeyValuePair <int, NPCSpawnPoint> kvp in points) { SceneEntityAgent agent = new SceneEntityAgent(kvp.Value); agent.ScenarioId = kvp.Value.ID; kvp.Value.agent = agent; SceneMan.AddSceneObj(agent); } }
void OnEntityDeath(SkillSystem.SkEntity cur, SkillSystem.SkEntity caster) { SkAliveEntity skAlive = entity.GetCmpt <Pathea.SkAliveEntity> (); if (cur == skAlive) { scene.Notify(ESceneNoification.MonsterDead, this); SceneMan.RemoveSceneObj(this); } }
void OnDestroy() { SceneChunkDependence.Instance.Reset(); if (_lodMan != null) { _lodMan.ReqDestroy(); _lodMan = null; } self = null; }
public bool GenDungeon(int seed = -1) { if (PeGameMgr.IsSingle) { RandomDungenMgrData.DungeonId++; } generator = new DungeonGenerator(dungeonData.dungeonFlowPath); manager.transform.position = RandomDungenMgrData.genDunPos; if (manager == null || manager.transform == null) { Debug.LogError("manager==null||manager.transform==null!"); return(false); } bool genSuccess = false; if (seed == -1) { genSuccess = generator.Generate(manager); //new if (!genSuccess) { return(false); } Debug.Log("gen success without seed"); GenWater_SafeBottom(RandomDungenMgrData.waterType); GeneralSet(true); GenContent(); } else { genSuccess = generator.GenerateWithSeed(manager, seed); if (!genSuccess) { return(false); } Debug.Log("gen success with seed"); GenWater_SafeBottom(RandomDungenMgrData.waterType); GeneralSet(true); } if (PeGameMgr.IsSingle) { } if (PeGameMgr.IsMulti) { seed = generator.ChosenSeed; PlayerNetwork.mainPlayer.RequestUploadDungeonSeed(RandomDungenMgrData.entrancePos, seed); Debug.Log("dun Seed: " + seed); ChangeOther(true); } Debug.Log("RemoveTerrainDependence"); SceneMan.RemoveTerrainDependence(); return(genSuccess); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
public new void TryGenObject() { // if (PeGameMgr.IsMulti) // { // } // else // { RandomItemMgr.Instance.AddItemToManager(this); SceneMan.AddSceneObj(this); // } }
public void TryGenFeces() { //if (PeGameMgr.IsMulti) //{ //} //else //{ RandomItemMgr.Instance.AddFeces(this); SceneMan.AddSceneObj(this); //} }
//multi processing result public RandomItemObj(Vector3 pos, int[] itemIdNum, Quaternion rot, string path = "Prefab/RandomItems/random_box01", int id = 0) { genPos = pos; position = pos; rotation = rot; this.id = id; items = itemIdNum; this.path = path; isNew = true; SceneMan.AddSceneObj(this); }
public void TryGenObject() { if (PeGameMgr.IsMulti) { } else { RandomItemMgr.Instance.AddItemToManager(this); SceneMan.AddSceneObj(this); } }
SceneEntityAgent _createMstAgent(MonsterSpawnPoint _point, bool is_saved, MonsterSpawnArea _area = null, MonsterSpawnPoint[] _groupPoints = null, bool save_to_scene = true) { SceneEntityAgent agent = new SceneEntityAgent(_point, is_saved, _area, _groupPoints); if (save_to_scene) { SceneMan.AddSceneObj(agent); } return(agent); }
void OnEntityDeath(SkillSystem.SkEntity cur, SkillSystem.SkEntity caster) { SkAliveEntity skAlive = entity.GetCmpt <Pathea.SkAliveEntity>(); if (cur == skAlive) { scene.Notify(ESceneNoification.DoodadDead, this); SceneMan.RemoveSceneObj(this); Debug.Log("Doodad Entity id [" + skAlive.GetId() + "] is dead"); } }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this); } else { Destroy(this.gameObject); } }
public void Fill(int cntNpc, int cntMonster) { Vector3 center = RectIdxToCenterPos(_idx); bool bAvailable = false; SceneEntityPosAgent agent; System.Random rand = new System.Random(); for (int i = 0; i < cntNpc; i++) { Vector3 point = !PeGameMgr.randomMap ? GetEntityPoint(center, out bAvailable) : GetNpcPointInRndTer(center, out bAvailable); if (bAvailable) { if (VFDataRTGen.IsTownConnectionType(Mathf.RoundToInt(point.x), Mathf.RoundToInt(point.z))) { agent = NpcEntityCreator.CreateAgent(point); agent.spInfo = _rndNpcAgentInfo; _posRndNpcAgents.Add(agent); // npc entity would not be destroyed by scene } else { if (rand.NextDouble() < 0.25) { agent = NpcEntityCreator.CreateAgent(point); agent.spInfo = _rndNpcAgentInfo; _posRndNpcAgents.Add(agent); // npc entity would not be destroyed by scene } } } } for (int i = 0; i < cntMonster; i++) { Vector3 point = GetEntityPoint(center, out bAvailable); if (bAvailable && null == AIErodeMap.IsInErodeArea2D(point)) { _posRndMonsterAgents.Add(MonsterEntityCreator.CreateAgent(point)); } } SceneMan.AddSceneObjs(_posRndNpcAgents); SceneMan.AddSceneObjs(_posRndMonsterAgents); if (PeGameMgr.IsStory) { _posFixedMonsterIds = AISpawnPoint.Find(center.x - EntityCreationRadius, center.z - EntityCreationRadius, center.x + EntityCreationRadius, center.z + EntityCreationRadius); if (_posFixedMonsterIds.Count > 0) { SceneEntityCreatorArchiver.Instance.AddFixedSpawnPointToScene(_posFixedMonsterIds); } } else if (PeGameMgr.IsSingleAdventure) { SceneEntityPosRect.AddProcedualBossSpawnPointToScene(_idx); } }
public RandomItemObj(int boxId, Vector3 pos, Quaternion rot, int[] itemIdNum, string path, int id = 0) { genPos = pos; this.boxId = boxId; position = pos; rotation = Quaternion.Euler(0, (new System.Random()).Next(360), 0); this.id = id; items = itemIdNum; this.path = path; isNew = true; SceneMan.AddSceneObj(this); }
public void SetSceneMan(SceneMan sman) { // this is attached as a component, thus we cannot set it in a contructor this.sman = sman; var gt = new graphtex(); var sca = new Vector3(7, 1, 9.76f); var rot = new Vector3(0, -90, 0); var trn = new Vector3(38.55f, 0, -27.79f); gt.SetMaterialPlane("RedwestBfloor3", 676, 938, sca, rot, trn); this.gt = gt; }
IEnumerator AddMemberAgents() { yield return(new WaitForSeconds(0.1f)); int n = _lstAgents.Count; for (int i = 0; i < n; i++) { SceneMan.AddSceneObj(_lstAgents[i]); yield return(new WaitForSeconds(0.1f)); } }
public void Respawn() { if (!mIsProcessing) { if (entity == null || (entity.GetCmpt <SkAliveEntity>() != null && entity.GetCmpt <SkAliveEntity>().isDead)) { entity = null; SceneMan.RemoveSceneObj(this); SceneMan.AddSceneObj(this); } } }
public void GenEnemyNpc(List <BuildingNpc> bNpcs, int townId, int allyId) { foreach (BuildingNpc bnpc in bNpcs) { int enemyNpcId = GetEnemyNpcId(bnpc.templateId); int allyColor = VATownGenerator.Instance.GetAllyColor(allyId); int playerId = VATownGenerator.Instance.GetPlayerId(allyId); SceneEntityPosAgent agent = MonsterEntityCreator.CreateAdAgent(bnpc.pos, enemyNpcId, allyColor, playerId); SceneMan.AddSceneObj(agent); VArtifactTownManager.Instance.AddMonsterPointAgent(townId, agent); } }
public void CheckDestroyObj() { if (items.Count() <= 0) { RandomItemMgr.Instance.RemoveRandomItemObj(this); if (gameObj != null) { GameObject.Destroy(gameObj); } SceneMan.RemoveSceneObj(this); } }
public override void OnDeactivate() { if (Equals(null)) { SceneMan.RemoveSceneObj(this); return; } if (onDeactivate != null) { onDeactivate(Entity); } }
void OnDeath(SkillSystem.SkEntity e1, SkillSystem.SkEntity e2) { _death = true; Clear(); SceneMan.RemoveSceneObj(_agent); if (DeathEvent != null) { DeathEvent(this); } }
public static bool Destory(DragItemAgent item) { if (null == item) { return(false); } SceneMan.RemoveSceneObj(item); item.Destroy(); return(true); }
// Ensures this script persists during scene change and is not duplicated when the Intro scene is revisited. void Awake() { DontDestroyOnLoad(this); if (singleton == null) { singleton = this; } else { Destroy(this.gameObject); } }
// Other methods/property void CreateEntityStatic() { _step = EStep.InCreating; DoodadEntityCreator.CreateDoodad(this); if (entity == null) { Debug.LogWarning("[EntityPosAgent]:Failed to create entity " + _type.ToString() + protoId); } // now doodad's lod(SceneDoodadLodCmpt) would handle doodads, posAgent not needed longer after dooad created. SceneMan.RemoveSceneObj(this); _step = EStep.Created; }