//unused, logic handled elsewhere in Employee now public void dismissRodent() { //Debug.Log("heard Dismiss"); if (bo) { bo.DismissWorker(_worker); } else if (ps) { ps.DismissWorker(_worker); } _worker = null; MVCController.Instance.showRedX(false); }
IEnumerator DeathDelay() { //Fun Way to use event system //EventSystem.Instance.IDied(this); //but this was already here and much cleaner/easier..lmao, oh well i learned alot if (_Job) { _Job.Dismiss(this); //Unassign self from job } //If teleported, have to find an un-assign self from outpost GameObject TeleportDummy = GameObject.FindGameObjectWithTag("TeleportedRodents"); if (TeleportDummy && this.transform.parent.gameObject == TeleportDummy) { ExitZone zone = GameManager.Instance.getPlayerZone(); if (zone) { BuildableObject garrison = zone.getRodentOutpost(this); if (garrison) { garrison.DismissWorker(this); } zone.RemoveDeadRodent(this); } } //Chance to Spawn Shiny if (_Team == 2) { if (_Type == eRodentType.EKing) { //drop crown GameObject crown = Resources.Load <GameObject>("ResourceIcons/Collectable_Crown"); if (crown) { crown = GameObject.Instantiate(crown, this.transform.position, this.transform.rotation); var c = crown.GetComponent <CoinResource>(); if (c) { var eKing = this.GetComponent <EKing>(); if (eKing) { c.setKingdomSide(eKing.getCrownSide()); } } } } else //drop shiny { int roll = Random.Range(0, 10); if (roll == 1) { GameObject pickup = Resources.Load <GameObject>("ResourceIcons/Collectable_Resource"); if (pickup) { GameObject ppp = GameObject.Instantiate(pickup, this.transform.position, this.transform.rotation); ppp.GetComponent <CoinResource>().setResourceType(ResourceManagerScript.ResourceType.Shiny); } } } } if (_NotifyAnimator) { Destroy(_NotifyAnimator.gameObject); } yield return(new WaitForSeconds(5f)); Destroy(this.gameObject); }