public void AddScoreAfterSplash(VirusHead virusHead) { for (int i = _numOfPeopleUnderSplash; i > 0; i--) { virusHead.AddScore(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (IsNotFlicker) { #region PeopleCollision if (collision.CompareTag("People")) { AddScore(); PlayPeopleEatSound(); OnPeopleEat?.Invoke(); if (collision.name != "D_People") { StartCoroutine(Twiner.UnsizeAndReposition(Spawner.NewPeoplePosition(), collision.gameObject)); } if (collision.name == "D_People") { StartCoroutine(Twiner.UnsizeAndDestroy(collision.gameObject)); } } #endregion #region VirusCollision if (collision.GetComponent <Tail>() != null && collision.name != gameObject.name) { if (collision.GetComponent <Tail>().head.IsNotFlicker) { PlayerCamera.Singletone.SetMoveTarget(collision.gameObject); PlayDeathSound(); Death(); } } if (collision.GetComponent <VirusHead>() != null && collision.name != gameObject.name) { VirusHead head = collision.GetComponent <VirusHead>(); if (head.IsNotFlicker) { if (head.Wide >= Wide) { PlayerCamera.Singletone.SetMoveTarget(collision.gameObject); PlayDeathSound(); Death(); } } } #endregion } if (collision.name == "PlayArea") { Stun(collision); } }
public void SetFields(GameObject _nextBody, VirusHead @this, float deathDelay, string name, Sprite sprite) { transform.localScale = @this.transform.localScale; head = @this; nextBody = _nextBody; _nextBodyTransform = _nextBody.transform; gameObject.name = name; _deathDelay = deathDelay; spriteRenderer.sprite = sprite; }