private void FixedUpdate() { Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position + new Vector3(0f, 0.5f, 0f), PLAYER_RADIUS, _obstacleLayer); for (int i = 0; i < colliders.Length; i++) { if (colliders[i].gameObject != gameObject) { GGJGameManager.KillPlayer(this); return; } } }
public void Grow() { float deltaTime = Time.deltaTime; _growOffset += Time.deltaTime; if (_growOffset > 1f) { GGJGameManager.KillPlayer(this); return; } else if (_growOffset > 0.3) { float offset = _growOffset - 0.3f; _graphicTransform.localPosition = new Vector3(Mathf.Sin(offset * 100) * offset, _graphicTransform.localPosition.y, 0f); _graphicTransform.localScale = new Vector3(1f + offset, 1f + offset); } }