You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
822 B

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<SpriteRenderer>().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);
}
}
}