void TryAddPenguin(PenguinController controller) { if (spawnedPenguins.Contains(controller)) { return; } spawnedPenguins.Add(controller); }
void OnPenguinEntered(PenguinController penguin) { if (penguin.IsAffectingCracks == false) { return; } ++currentPenguingSteps; var maxSteps = penguin.MaxStepsOnCrack; var stepsDifference = Mathf.Max(0, maxSteps - currentPenguingSteps); var value = 1f - (float)stepsDifference / maxSteps; var newScale = Vector3.Lerp(transform.localScale, minCrackScale, value); transform.DOScale(newScale, 0.3f); if (stepsDifference == 0) { Invoke("DestroyCrack", 1f); } }