コード例 #1
0
        public static RespawnPoint GetInitRespawn()
        {
            RespawnPoint respawn      = null;
            int          initRespawns = 0;

            foreach (RespawnPoint point in FindObjectsOfType <RespawnPoint>())
            {
                if (point.initialSpawn)
                {
                    respawn = point;
                    initRespawns++;
                }
            }

            if (initRespawns == 0)
            {
                Debug.LogWarning("No initial respawn point detected.");
            }
            else if (initRespawns > 1)
            {
                Debug.LogWarning("More than one initial respawn point detected.");
            }

            return(respawn);
        }
コード例 #2
0
        private void Awake()
        {
            controller     = GetComponent <InputController>();
            playerCollider = GetComponent <Collider2D>();
            lantern        = GetComponentInChildren <Lantern>();

            if (respawn == null)
            {
                respawn = RespawnPoint.GetInitRespawn();
            }
        }
コード例 #3
0
        public override void OnInspectorGUI()
        {
            RespawnPoint respawn = (RespawnPoint)target;

            DrawDefaultInspector();

            if (GUILayout.Button("Add Lamp"))
            {
                respawn.AddLamp();
            }
            if (GUILayout.Button("Remove Lamp"))
            {
                respawn.RemoveLamp();
            }
        }