void OnMouseDown() { if (PlayerController.Current.MagicPower < CastingCost) { return; } PlayerController.Current.MagicPower -= CastingCost; DestroyObject(gameObject); PlayerController.Current.CastAnimation(); Soundboard.PlayRockBreak(); Cloud c = (Cloud)Instantiate(PlayerController.Current.CloudPrefab); c.transform.position = this.transform.position; if (Contains == "Ruby") { Transform r = (Transform)Instantiate(PlayerController.Current.RubyPrefab); r.transform.position = this.transform.position; r.transform.parent = this.transform.parent; transform.parent.GetComponent <ObjectLayerFader>().ResetObjects = true; } else if (Contains == "Monster") { RockMonster r = (RockMonster)Instantiate(PlayerController.Current.MonsterPrefab); r.transform.position = this.transform.position; r.transform.parent = this.transform.parent; transform.parent.GetComponent <ObjectLayerFader>().ResetObjects = true; } }
void Start() { RockMonster rm = (RockMonster)Instantiate(PlayerController.Current.MonsterPrefab); rm.transform.position = transform.position; rm.transform.parent = transform.parent; if (transform.parent.name.StartsWith("Underworld")) { rm.gameObject.layer = 11; } transform.parent.gameObject.GetComponent <ObjectLayerFader>().ResetObjects = true; DestroyObject(this.gameObject); }