void Start() { CatSwitch = GameObject.FindGameObjectWithTag("CatSwitch").transform; CS = GameObject.FindGameObjectWithTag("CatSwitch").GetComponent <CatSwitchScript>(); SR = GetComponent <SpriteRenderer>(); SR.sprite = sprites[0]; }
public void Hit(int damage) { CatSwitchScript CSS = CS.GetComponent <CatSwitchScript> (); CSS.hp -= damage; if (CSS.hp <= 0) { Respawn(); } }
private void Awake() { if (Instance != null) { Destroy(gameObject); } else { Instance = this; DontDestroyOnLoad(gameObject); hp = maxLife; } }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag.Substring(0, 4) == "Gato") { CatSwitchScript cs = GameObject.FindGameObjectWithTag("CatSwitch").GetComponent <CatSwitchScript> (); if (Cat == null) { cs.canBruxoAttack = true; } else { if (!cs.Cats.Contains(Cat)) { cs.Cats.Add(Cat); } cs.SwitchCat(Cat); } Destroy(gameObject); } }
private void Start() { CS = GameObject.FindGameObjectWithTag("CatSwitch").GetComponent <CatSwitchScript>(); }