void OnDeath(GameObject from) { if (from.name == "mushMine(Clone)") { from.GetComponent <MushBehavior>().CollectLoot(lootKind, lootCount); } else if (from.GetComponent <TankController>() != null) { UxChatController.SendToConsole( String.Format("{0} acquired {1} {2}", from.GetComponent <TankController>().playerName, lootCount, NameMapping.ForProjectile(lootKind))); var inventory = from.GetComponent <ProjectileInventory>(); if (inventory != null) { inventory.ServerModify(lootKind, lootCount); } } if (lootKind == ProjectileKind.mushboom) { LootSpawnController.singleton.mushboomCount--; } Destroy(gameObject); }
public void InfectPlayer(GameObject patientZero) { virusParticles.Play(); hasVirus = true; infectingPlayer = patientZero; UxChatController.SendToConsole("" + gameObject.name + " has been infected with an E-Virus!"); }
void OnDeath(GameObject from) { if (!isDead) { isDead = true; transform.Find("Model").gameObject.SetActive(false); if (isServer) { DealDamage(from); CreateExplosion(); PerformTerrainDeformation(terrain.gameObject); UxChatController.SendToConsole(owner.playerName + "'s MushBoom was destroyed!"); float aNumber = UnityEngine.Random.Range(0f, 1f); if (aNumber < 0.5) { if (owner != null) { UxChatController.SendToConsole(owner.playerName + " scavenged a spore!"); var inventory = owner.GetComponent <ProjectileInventory>(); inventory.ServerModify(ProjectileKind.mushboom, 1); } } Destroy(gameObject); } } }
private void PrepForMushMine() { spawnMush = true; mushSpawnLoc = new Vector3(transform.position.x, transform.position.y - 0.85f, transform.position.z); explosionKind = ExplosionKind.mushPlant; effectRadius = 4f; UxChatController.SendToConsole(shooter.playerName + " has planted a MushBoom!"); }
private void AdvanceStage() { switch (stage) { case 1: explosionScale = 2; break; case 2: effectRadius += 10; explosionScale = 3; deformationKind = DeformationKind.littleZero2; break; case 3: effectRadius += 10; explosionScale = 4; deformationKind = DeformationKind.littleZero3; break; case 4: effectRadius += 10; explosionScale = 5; deformationKind = DeformationKind.littleZero4; break; case 5: effectRadius += 10; explosionScale = 6; deformationKind = DeformationKind.littleZero5; break; } scaleTo = transform.localScale + growthSpurt; int percentReady = stage * 19; switch (percentReady) { case 19: case 38: case 57: case 76: UxChatController.SendToConsole(owner.playerName + "'s MushBoom", messageColor, percentReady.ToString() + "% critical mass! #Growing"); break; case 95: UxChatController.SendToConsole(owner.playerName + "'s MushBoom", warningColor, "Ready soon! #Wheaties"); break; } StartCoroutine(GrowTheShroom()); }
void OnDeath(GameObject from) { // Debug.Log("OnDeath"); UxChatController.SendToConsole( String.Format("{0} terminated {1}", from.GetComponent <TankController>().playerName, playerName)); var manager = TurnManager.GetGameManager(); if (manager != null) { manager.ServerHandleTankDeath(gameObject); } }
private IEnumerator FinishThem() { UxChatController.SendToConsole(owner.playerName + "'s MushBoom", messageColor, "It's been a blast! #Laterz"); scaleDelay = 0; timeToScale = 10f; groundZero = GameObject.FindWithTag("groundZero"); Vector3 fixedSpot = new Vector3(100f, 15f, 100f); deformationKind = DeformationKind.groundZero; SingedMessages.SendPlayAudioClip("MushboomSound/mushboom_growth"); yield return(new WaitForSeconds(1f)); scaleTo *= 4f; nukeGreen.Emit(150); StartCoroutine(GrowTheShroom()); yield return(new WaitForSeconds(1f)); nukeIsReady.Invoke(); nukeGreen.Emit(150); nukeGreen.transform.localScale *= 2f; yield return(new WaitForSeconds(0.75f)); nukeGreen.Emit(200); yield return(new WaitForSeconds(1f)); nukeGreen.transform.localScale *= 2; nukeGreen.Emit(200); yield return(new WaitForSeconds(1.25f)); explosion.Play(); nukeGreen.Emit(200); yield return(new WaitForSeconds(4.5f)); Destroy(explosion); Destroy(nukeGreen); transform.position = fixedSpot; if (isServer) { PerformTerrainDeformation(groundZero); } Destroy(gameObject); }
public void SetAreaOfEffect(string effect) { switch (effect) { case "radiation": case "Radiation": UxChatController.SendToConsole(gameObject.name + " was hit with mushtonium!"); break; case "slow": case "Slow": isSlowed = true; slowParticles.Play(); UxChatController.SendToConsole("" + gameObject.name + " has been slowed with molasses!"); break; default: break; } }
private void DivvyLoot() { List <int> theIndices = TurnManager.singleton.activeTanks; Dictionary <int, TankController> theTanks = TurnManager.singleton.tankRegistry; TankController theWinner; int index = UnityEngine.Random.Range(0, theIndices.Count); if (theIndices.Count > 1) { for (int i = 0; i < lootPool.Count; i++) { if (index >= theIndices.Count) { index = 0; } theWinner = theTanks[theIndices[index]]; if (theWinner != null) { var inventory = theWinner.GetComponent <ProjectileInventory>(); if (inventory != null) { inventory.ServerModify(lootPool[i], lootCount[i]); } UxChatController.SendToConsole( String.Format("{0} scavenged {1} {2}", theWinner.playerName, lootCount[i], NameMapping.ForProjectile(lootPool[i]))); } index++; } } lootPool.Clear(); lootCount.Clear(); }
public void CmdSendToConsole(string newChat) { UxChatController.SendToConsole(this, newChat); }
void OnCollisionEnter(Collision collision) { //Debug.Log("ProjectileController OnCollisionEnter with: " + collision.collider.name); // only trigger explosion (spawn) if we currently have authority // run collisions on server only if (isServer && !hasCollided) { // single collision/explosion per projectile hasCollided = true; // hide model so it doesn't bounce around before getting destroyed transform.Find("Model").gameObject.SetActive(false); switch (myKind) { case ProjectileKind.mushboom: rb.isKinematic = true; if (collision.gameObject.name == "Terrain") { GameObject[] activeMushes = GameObject.FindGameObjectsWithTag("mushMine"); for (int i = 0; i < activeMushes.Length; i++) { if (activeMushes[i].GetComponent <MushBehavior>().owner == shooter) { spawnMush = false; effectRadius = 10f; break; } else { spawnMush = true; } } if (activeMushes.Length < 1) { spawnMush = true; } } if (spawnMush) { PrepForMushMine(); } else { float aNumber = UnityEngine.Random.Range(0f, 2f); if (aNumber < 0.5 && shooter != null) { UxChatController.SendToConsole(shooter.playerName + " scavenged a spore!"); var inventory = shooter.GetComponent <ProjectileInventory>(); inventory.ServerModify(myKind, 1); } } ServerExplode(collision); break; case ProjectileKind.teleportBall: PerformTerrainDeformation(collision.gameObject); CreateExplosion(); if (collision.gameObject.name == "Terrain") { gameObject.GetComponent <Light>().enabled = false; StartCoroutine(TeleportPlayer()); } break; default: Debug.Log("" + gameObject.name + " collided with " + collision.gameObject.name); ServerExplode(collision); break; } } }