private void onSpawnSoul(SpawnSoul spawn) { Debug.LogFormat("spawn a soul: {0} at {1}", spawn.playerName, spawn.position); GameObject soul = Instantiate(soulPrefab, spawn.position, Quaternion.identity); if (spawn.playerName != "") { soul.name = spawn.playerName; } else { soul.name = "F**K"; } GameObject allSouls = GameObject.Find("Souls"); if (allSouls == null) { Debug.LogError("unable to find souls container!"); } else { soul.transform.SetParent(allSouls.transform); SoulController sc = soul.GetComponent <SoulController>(); sc.playerName = spawn.playerName; } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Enemy") && pc.isAttacking) { sc = collision.gameObject.GetComponent <SoulController>(); sc.TakeDamage(damage); } }
public SoulController deliveryOneSoulToEndLevel(Transform t) { if (availableSouls.Count > 0) { SoulController s = availableSouls[0]; soulsOnScene.Add(s); availableSouls.Remove(s); s.gameObject.SetActive(true); s.goToEndLevel(t); return(s); } return(null); }
public SoulController throwOnDeliveryScene(Transform origin, Transform targ) { if (availableSouls.Count > 0) { SoulController s = availableSouls[0]; soulsOnScene.Add(s); availableSouls.Remove(s); s.gameObject.SetActive(true); s.throwOnDeliveryScene(origin, targ); return(s); } return(null); }
void OnTriggerEnter(Collider other) { // Debug.LogFormat("Player triggered other: {0}", other); if (other.CompareTag("Soul")) { SoulController soul = other.GetComponent <SoulController>(); networking.SendCollectSoul(soul.playerName, other.transform.position); Destroy(other.gameObject); } if (other.CompareTag("Fatal")) { networking.SendDeath(transform.position + Vector3.up * 0.5f); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Enemy")) { sc = collision.gameObject.GetComponent <SoulController>(); audio.clip = enemyInPortal; audio.Play(); th.TreeTakeDamage(sc.enemyDmgToTree); Destroy(collision.gameObject); } if (collision.gameObject.CompareTag("Friendly")) { audio.clip = friendInPortal; audio.Play(); Destroy(collision.gameObject); } }
public GameSession(GameClientType t1CT, GameClientType t2CT, Scenario scenario, Viewport vp, bool attractmode) { Instance = this; Team1ClientType = t1CT; Team2ClientType = t2CT; Team1Reinforcements = scenario.T1Reinforcements; Team2Reinforcements = scenario.T2Reinforcements; Team1StartReinforcements = scenario.T1Reinforcements; Team2StartReinforcements = scenario.T2Reinforcements; Team1SpawnRate = scenario.T1SpawnRate; Team2SpawnRate = scenario.T2SpawnRate; Team1DeadCount = 0; Team2DeadCount = 0; Team1SoulCount = 0; Team2SoulCount = 0; Team1Win = false; Team2Win = false; AvailableFunctions = scenario.AvailableFunctions; DudeController = new DudeController(); ButtonController = new ButtonController(); SoulController = new SoulController(); ProjectileController = new ProjectileController(); ParticleController = new ParticleController(); HUD = new HUD(); AI1.Initialize(scenario.AIReactionTime); AI2.Initialize(scenario.AIReactionTime); Viewport = vp; IsAttractMode = attractmode; ScreenBottom = (IsAttractMode ? 0 : 60); StartCountdown = (IsAttractMode ? 0 : 4000); prepareTransition = (IsAttractMode ?0f:1f); fightTransition = 0f; Map = new Map(scenario.MapName); }
private void Awake() { Instance = this; }
public void removeSoulFromScene(SoulController soul) { soulsOnScene.Remove(soul); availableSouls.Add(soul); soul.gameObject.SetActive(false); }
void PlayNextWave() { SoulSpawn sp = GameObject.FindGameObjectWithTag("SoulSpawner").GetComponent <SoulSpawn>(); gm.waveCounter = gm.waveCounter + 1; switch (gm.waveCounter) { case 1: //AddMobs(5, 10); textTyper.message = "Wave 1"; if (!textTyper.CR_isRunning) { textTyper.startTextCoroutine(4); } break; case 2: HealTree(); AddMobs(20, 40); textTyper.message = "Wave 2, Tree's healt will be updated"; if (!textTyper.CR_isRunning) { textTyper.startTextCoroutine(4); } break; case 3: HealTree(); AddMobs(40, 70); textTyper.message = "Wave 3, Tree's healt will be updated"; if (!textTyper.CR_isRunning) { textTyper.startTextCoroutine(4); } int index = 0; foreach (GameObject enemy in sp.SoulsArray) { sp.SoulsArray[index] = sp.SoulEvilBig; index++; } break; case 4: HealTree(); AddMobs(70, 120); textTyper.message = "Wave 4, Tree's healt will be updated"; if (!textTyper.CR_isRunning) { textTyper.startTextCoroutine(4); } foreach (GameObject enemy in sp.SoulsArray) { sp.startTimer = 1.8f; } break; case 5: HealTree(); AddMobs(120, 200); textTyper.message = "Wave 5, Tree's healt will be updated"; if (!textTyper.CR_isRunning) { textTyper.startTextCoroutine(4); } foreach (GameObject enemy in sp.SoulsArray) { SoulController scBig = sp.SoulEvilBig.GetComponent <SoulController>(); scBig.currentHealth = 100; scBig.enemyDmgToTree = 50; SoulController scSmall = sp.SoulEvil.GetComponent <SoulController>(); scBig.currentHealth = 60; scBig.enemyDmgToTree = 25; sp.startTimer = 0.9f; } break; case 6: HealTree(); AddMobs(200, 400); textTyper.message = "Wave 6, Tree's healt will be updated"; if (!textTyper.CR_isRunning) { textTyper.startTextCoroutine(4); } break; default: AddMobs(320, 1000); break; } }