public void Init(LevelGamePartID gamePartId, LevelPartID id) { SpawnEnemyManager spawnManager = AddScript <SpawnEnemyManager>(ConstValue.GAME_PART_SPWAN_POINT); spawnManager?.Init(); AddScript <PartWall>(ConstValue.GAME_PART_WALL)?.Init(gamePartId, id, () => spawnManager.Spawn()); }
// Use this for initialization void Start() { if (ins == null) { ins = this; } else { Destroy(gameObject); } }
private void Awake() { if (!Instance) { Instance = this; } else { Destroy(gameObject); } }
private void Awake() { if (EnemyForSpawn) { if (instance == null) { instance = this; DontDestroyOnLoad(this); checkSpawnPos.direction = Vector3.down * 10f; checkSpawnBounds = EnemyForSpawn.GetComponent <Collider>().bounds; } else { Destroy(gameObject); } } else { throw new System.Exception("Enemy for spawn is not used"); } }