private void OnCollisionEnter2D(Collision2D collision) { Playar temp = collision.transform?.GetComponent <Playar>(); if (temp != null) { temp.StartBigPlayar(); Destroy(gameObject); } }
private void Start() { for (int i = 0; i < EnemyNumber; i++) { CreateEnemy(EnemyArrey[Random.Range(0, EnemyArrey.Length)]); } player = FindObjectOfType <Playar>(); player.SetEnemyList(EnemyList); }
private void OnCollisionEnter2D(Collision2D collision) { Playar temp = collision.transform?.GetComponent <Playar>(); if (temp != null) { temp.StarSuperPlayar(); Destroy(gameObject); } else { _rigetbody.AddForce(Vector2.up * jumpFors, ForceMode2D.Impulse); } }
private void Start() { player = FindObjectOfType <Playar>(); if (player != null) { FullHipPoint = player.GetHitPoint(); player.UpdateHpEvent += UpdateHitBar; player.UpdateHpEvent += UpdateText; } else { Debug.Log("From HitPointBar: Playar is not faund"); } HitPointText.text = FullHipPoint.ToString(); }
private void OnTriggerEnter2D(Collider2D collision) { Playar temp = collision?.GetComponent <Playar>(); if (temp != null) { if (temp.EatMashrim == false) { temp.StartBigPlayar(); } else { temp.StartFlowerPlayar(); } Destroy(gameObject); } }