static public void reportSpecialMonsterSpawned(SpecialMonster monster) { #if UNITY_ANALYTICS if (!isTrackingEvents) { return; } AnalyticsEvent.Custom(specialMonsterDeployed, new Dictionary <string, object> { { "name", monster.gameObject.name } }); #endif }
/// <summary> /// Checks if we are able to spawn a special monster on the opponents board /// </summary> /// <param name="monsterPrefab">Monster to check</param> /// <param name="prefabName">Path from resources folder to prefab</param> /// <returns>If monster can be spawned</returns> private bool canSpawnSpecialMonster(SpecialMonster monsterPrefab, string prefabName) { if (!monsterPrefab || string.IsNullOrEmpty(prefabName)) { return(false); } // Might be in-between rounds if (!m_canSpawnMonsters || m_monsterSpawnLocked) { return(false); } if (PhotonNetwork.IsConnected && !photonView.IsMine) { return(false); } return(canAfford(monsterPrefab.Cost)); }
/// <summary> /// Spawns a special monster to deploy to the opponents board /// </summary> /// <param name="monsterPrefab">Monster to spawn</param> /// <param name="prefabName">Actual path to monster prefab from resources folder</param> public void spawnSpecialMonster(SpecialMonster monsterPrefab, string prefabName) { if (!canSpawnSpecialMonster(monsterPrefab, prefabName)) { return; } BoardManager opponentsBoard = GameManager.manager.OpponentsBoard; if (opponentsBoard) { opponentsBoard.spawnMonster(prefabName, PhotonNetwork.LocalPlayer); // Apply costs for spawning this monster consumeGold(monsterPrefab.Cost); if (monsterPrefab.Delay > 0f) { m_monsterSpawnLocked = true; Invoke("unlockMonsterSpawn", monsterPrefab.Delay); } } }