示例#1
0
    // -----
    // Use this for initialization
    void Start()
    {
#if UNITY_EDITOR
        if (isDebug)
        {
            respawnPos = debugRespawnPos[debugPosIndex];
        }
#endif
        GameObject NetworkManagerObj = GameObject.FindGameObjectWithTag("NetworkManager");
        networkManager = NetworkManagerObj.GetComponent <NetworkManager>();

        GameObject logManagerObj = GameObject.FindWithTag("LogManager");
        if (logManagerObj != null)
        {
            logManager = logManagerObj.GetComponent <LogManager>();
        }

        PlayData.gameMode = GameMode.Play;

        // BGM
        BgmManager.Play("Threat");

        // ゴールの扉制御
        SetOnceCall(() => PlayData.bossDied, () => {
            goalGate.SetActive(false);
            // BGMの変更
            BgmManager.Play("JumpAndShootMan");
        });

        PlayData.loadDB = new BoolNoticer(false);
        PlayData.loadDB.SetOnChange(true, _ => MakeDeadDBData());

        corpseManager = GameObject.FindWithTag("CorpseManager").GetComponent <CorpseManager>();
        corpseManager.LoadData();
    }
示例#2
0
    void Snap()
    {
        if (snapPermanently && rigidbody != null)
        {
            rigidbody.isKinematic = true;
            //DestroyImmediate(rigidbody);
        }


        if (snapPosition != target.position)
        {
            snapPosition = Com.Round(target.position, unitsPerPixel);
        }

        if (snapRotation != target.rotation)
        {
            Vector3 snapRotationEuler = target.rotation.eulerAngles;
            snapRotationEuler.z = Com.Round(snapRotationEuler.z, 90f);
            snapRotation        = Quaternion.Euler(snapRotationEuler);
        }


        transform.position = snapPosition;
        transform.rotation = snapRotation;

        if (snapPermanently)
        {
            if (corpseOnSnap)
            {
                CorpseManager.CreateCorpse(gameObject);
            }
            //Destroy(this);
        }
    }
示例#3
0
    void Timeout()
    {
        switch (onTimeout)
        {
        case OnTimeout.Destroy:
            ObjectManager.Destroy(gameObject);
            break;

        case OnTimeout.Disable:
            gameObject.SetActive(false);
            break;

        case OnTimeout.Corpse:
            CorpseManager.CreateCorpse(gameObject);
            break;
        }
    }
示例#4
0
    public static void Destroy(GameObject gameObject)
    {
        PooledObject pooledObject = gameObject.GetComponent <PooledObject>();

        if (pooledObject != null)
        {
            if (pooledObject.isCorpse)
            {
                CorpseManager.AddObject(gameObject);
                return;
            }

            if (!pooledObject.dirty)
            {
                pooledObject.parentPool.AddObject(gameObject);
                return;
            }
        }

        UnityEngine.Object.Destroy(gameObject);
    }
示例#5
0
    public static void CompileDictionaries()
    {
        nameDic = new Dictionary <string, GameObject>();

        objectPools = new Dictionary <GameObject, ObjectPool>();

        for (int i = 0; i < Instance.prefabs.Length; i++)
        {
            nameDic.Add(Instance.prefabs[i].name, Instance.prefabs[i]);
        }

        for (int i = 0; i < Instance.presetPools.Length; i++)
        {
            if (!objectPools.ContainsKey(Instance.presetPools[i].prefab))
            {
                Instance.presetPools[i].Initialize();
                objectPools.Add(Instance.presetPools[i].prefab, Instance.presetPools[i]);
            }
        }

        CorpseManager.Initialize(Instance.corpse);
    }
 private void OnDestroy()
 {
     gi = null;
 }
 private void Awake()
 {
     gi = this;
 }
示例#8
0
 void Awake()
 {
     cmInstance      = this;
     currentCorpseId = 0;
 }