private void Awake() { if (instance == null) { instance = this; } }
private void SaveConfiguration() { var spawnAsset = ScriptableObject.CreateInstance <CoinSpawns>(); var targetPath = Filename; if (targetPath.Length == 0) { Filename = targetPath = AssetDatabase.GenerateUniqueAssetPath("Assets/Config/Spawns/Spawn.asset"); } var coins = GameObject.FindObjectsOfType <Coin>(); spawnAsset.TargetAmount = TargetAmount; spawnAsset.IsSolvable = IsSolvable; foreach (var coin in coins) { var spawn = new CoinSpawn(); spawn.CoinID = coin.Config.CoinID; spawn.Position = coin.transform.position; spawn.Rotation = coin.transform.rotation; spawnAsset.Spawns.Add(spawn); } AssetDatabase.CreateAsset(spawnAsset, targetPath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorUtility.FocusProjectWindow(); Selection.activeObject = spawnAsset; }
private void SpawnCoin(GameConfig gameConfig, Coin coinPrefab, CoinSpawn spawn) { var obj = Instantiate(coinPrefab, spawn.Position, spawn.Rotation); var coin = obj.GetComponent <Coin>(); coin.Config = gameConfig.GetCoinConfig(spawn.CoinID); coin.ApplyConfig(); }
public static void AddInvoker_Battle_AddCoins(CoinSpawn coinScript) { invokers_Battle_AddCoins.Add(coinScript); if (listener_Battle_AddCoins != null) //foreach (UnityAction<int> listener in listeners_Battle_EnemyDeathEnd) { coinScript.AddListener_Battle_AddCoins(listener_Battle_AddCoins); } }
// Use this for initialization void Start() { m_playerManagers = new List <Manager>(); Manager player1Manager = GameObject.FindGameObjectWithTag("ManagerP1").GetComponent <Manager>(); m_playerAmount = player1Manager.Controllers; for (int i = 0; i < m_playerAmount; i++) { m_playerManagers.Add(GameObject.FindGameObjectWithTag("ManagerP" + (i + 1)).GetComponent <Manager>()); } CoinSpawn = GetComponentInParent <CoinSpawn>(); flip = GetComponentInParent <CoinFlip>(); }
void SetComponentsEnabled(bool isEnabled) { EnemyManager enemyManager = GameObject.FindGameObjectWithTag(ENEMY_MANAGER).GetComponent <EnemyManager>(); InputManager inputManager = GameObject.FindGameObjectWithTag(TAG_TOUCH).GetComponent <InputManager>(); GameObject spawnManager = GameObject.FindGameObjectWithTag(TAG_SPAWN_MANAGER); CoinSpawn coinSpawn = spawnManager.GetComponent <CoinSpawn>(); PowerupSpawn powerupSpawn = spawnManager.GetComponent <PowerupSpawn>(); HealSpawn healSpawn = spawnManager.GetComponent <HealSpawn>(); _countdown.gameObject.SetActive(isEnabled); _playerCollider.enabled = isEnabled; enemyManager.enabled = isEnabled; coinSpawn.enabled = isEnabled; powerupSpawn.enabled = isEnabled; healSpawn.enabled = isEnabled; _timer.enabled = isEnabled; inputManager.enabled = isEnabled; _hasGameStarted = isEnabled; }
IEnumerator coinCoolDown(CoinSpawn spawn) { yield return(new WaitForSeconds(coinSpawnDelay * 6f)); unusableCoinSpawns.Remove(spawn); }
void Start() { //Health Status InitialHealth = 100; currentHealth = InitialHealth; EnemyFX = GetComponents<AudioSource>(); //Get all audioSource Component in Zombie HurtClip = EnemyFX[0]; //Assign first audioSource as Hurt deathClip = EnemyFX[1]; // Second as Dead EnemyAnimator = GetComponent<Animator>(); EnemyParticleSystem = GetComponentsInChildren <ParticleSystem>(); //Get multi Particles System Component from child BloodParticleSystem = EnemyParticleSystem[0]; DeadBloodParticleSystem = EnemyParticleSystem[1]; EnemyboxCollider = GetComponent<BoxCollider> (); scoreManager = GameObject.Find("ScoreManager").GetComponent<ScoreManager>(); CoinCountScript = GameObject.Find ("LevelManager").GetComponent<CoinSpawn>(); }