using UnityEngine; namespace Game { public class NewBall : Collectable { public float permanentDuration; public float temporaryDuration; private bool isPermanent; public bool IsPermanent { private get => isPermanent; set { isPermanent = value; const float intensity = 1f; float factor = Mathf.Pow(2, intensity); float r = value ? 1 : 0; float g = 1; float b = value ? 0 : 1; Color borderColor = new Vector4(r, g, b, 1) * factor; GetComponent().material.color = borderColor; } } protected override void Setup() { } protected override float Duration() { return IsPermanent ? permanentDuration : temporaryDuration; } protected override void OnCollect(Player player) { GameManager.Singleton.SpawnBall(player, isPermanent); } } }