Exemplo n.º 1
0
 public void DestroySelf()
 {
     RandomItemMgr.Instance.RemoveRandomItemObj(this);
     if (gameObj != null)
     {
         GameObject.Destroy(gameObj);
     }
     SceneMan.RemoveSceneObj(this);
 }
Exemplo n.º 2
0
 public void DestroySelf()
 {
     if (gameObj != null)
     {
         GameObject.Destroy(gameObj);
     }
     SceneMan.RemoveSceneObj(this);
     DungeonEntranceLabel.Remove(position);
 }
Exemplo n.º 3
0
    public static void DestroyAllInDungeon()
    {
        List <ISceneObjAgent> allItem = SceneMan.FindAllDragItemInDungeon();

        for (int i = allItem.Count - 1; i >= 0; i--)
        {
            DragItemAgent.Destory(allItem[i] as DragItemAgent);
        }
    }
Exemplo n.º 4
0
 // 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);
     }
 }
Exemplo n.º 5
0
    // 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();
        //}
    }
Exemplo n.º 6
0
 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);
     }
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
 void OnDestroy()
 {
     SceneChunkDependence.Instance.Reset();
     if (_lodMan != null)
     {
         _lodMan.ReqDestroy();
         _lodMan = null;
     }
     self = null;
 }
Exemplo n.º 10
0
    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);
    }
Exemplo n.º 11
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 12
0
    public new void TryGenObject()
    {
//		if (PeGameMgr.IsMulti)
//		{
//		}
//		else
//		{
        RandomItemMgr.Instance.AddItemToManager(this);
        SceneMan.AddSceneObj(this);
//		}
    }
Exemplo n.º 13
0
 public void TryGenFeces()
 {
     //if (PeGameMgr.IsMulti)
     //{
     //}
     //else
     //{
     RandomItemMgr.Instance.AddFeces(this);
     SceneMan.AddSceneObj(this);
     //}
 }
Exemplo n.º 14
0
 //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);
 }
Exemplo n.º 15
0
 public void TryGenObject()
 {
     if (PeGameMgr.IsMulti)
     {
     }
     else
     {
         RandomItemMgr.Instance.AddItemToManager(this);
         SceneMan.AddSceneObj(this);
     }
 }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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");
            }
        }
Exemplo n.º 18
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 19
0
    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);
        }
    }
Exemplo n.º 20
0
 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);
 }
Exemplo n.º 21
0
        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;
        }
Exemplo n.º 22
0
    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));
        }
    }
Exemplo n.º 23
0
 public void Respawn()
 {
     if (!mIsProcessing)
     {
         if (entity == null || (entity.GetCmpt <SkAliveEntity>() != null && entity.GetCmpt <SkAliveEntity>().isDead))
         {
             entity = null;
             SceneMan.RemoveSceneObj(this);
             SceneMan.AddSceneObj(this);
         }
     }
 }
Exemplo n.º 24
0
 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);
     }
 }
Exemplo n.º 25
0
 public void CheckDestroyObj()
 {
     if (items.Count() <= 0)
     {
         RandomItemMgr.Instance.RemoveRandomItemObj(this);
         if (gameObj != null)
         {
             GameObject.Destroy(gameObj);
         }
         SceneMan.RemoveSceneObj(this);
     }
 }
Exemplo n.º 26
0
        public override void OnDeactivate()
        {
            if (Equals(null))
            {
                SceneMan.RemoveSceneObj(this);
                return;
            }

            if (onDeactivate != null)
            {
                onDeactivate(Entity);
            }
        }
Exemplo n.º 27
0
    void OnDeath(SkillSystem.SkEntity e1, SkillSystem.SkEntity e2)
    {
        _death = true;

        Clear();

        SceneMan.RemoveSceneObj(_agent);

        if (DeathEvent != null)
        {
            DeathEvent(this);
        }
    }
Exemplo n.º 28
0
    public static bool Destory(DragItemAgent item)
    {
        if (null == item)
        {
            return(false);
        }

        SceneMan.RemoveSceneObj(item);

        item.Destroy();

        return(true);
    }
Exemplo n.º 29
0
    // 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);
        }
    }
Exemplo n.º 30
0
    // 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;
    }