private void OnTriggerEnter2D(Collider2D otherCollider) { PlayerHealthDisplay playerLivesObj = FindObjectOfType <PlayerHealthDisplay>(); playerLivesObj.DecreaseLives(); Destroy(otherCollider.gameObject); }
// Use this for initialization void Start() { playerHealth = PlayerHealth.Instance; this.gameObject.AddComponent<PlayerHealthDisplay>(); healthDisplay = this.GetComponent<PlayerHealthDisplay>(); //****** TODO ******// // MovePlayer - jump at least // Shoot at cat }
// Use this for initialization void Start() { playerHealth = PlayerHealth.Instance; this.gameObject.AddComponent<PlayerHealthDisplay>(); healthDisplay = this.GetComponent<PlayerHealthDisplay>(); audioSrc = GetComponent<AudioSource> (); audioSrc.clip = steam; audioSrc.Play(); }
void Start() { float distance = transform.position.z - Camera.main.transform.position.z; var leftmost = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, distance)); var rightmost = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, distance)); xmin = leftmost.x + padding; xmax = rightmost.x - padding; Debug.Log(leftmost.ToString()); Debug.Log(rightmost.ToString()); healthDisplay = GameObject.Find("Player Health Display").GetComponent <PlayerHealthDisplay>(); }
private void Start() { health = FindObjectOfType <PlayerHealthDisplay>(); }
void Start() { healthClass = gameObject.GetComponent <PlayerHealth>(); healthDisplay = gameObject.GetComponent <PlayerHealthDisplay>(); }