private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { gameObject.layer = transform.parent.gameObject.layer; sprite = transform.GetChild(0); trail = sprite.GetComponent <TrailRenderer>(); initialSpriteSize = sprite.localScale; initialSpritePosition = sprite.localPosition; controller = GetComponent <HatController> (); col = GetComponent <BoxCollider2D> (); }
// public bool playerAtHat = false; // Use this for initialization void Awake() { if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref { // DontDestroyOnLoad(gameObject); StaticRef = this; } else if (StaticRef != this) // is the allready is a ref , destory this { Destroy(this); } }
void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("Player")) { Controller2D p = other.gameObject.GetComponent <Controller2D> (); if (p != null) { transform.parent.GetComponent <Liquid>().Splash(other.transform.position.x, 0.3f); } //print ("bye!"); } if (other.CompareTag("Hat")) { HatController h = other.gameObject.GetComponent <HatController> (); if (h != null) { transform.parent.GetComponent <Liquid>().Splash(other.transform.position.x, 0.3f); } } }
void Start() { hat = GetComponent <Hat>(); hatController = GetComponent <HatController>(); }