Add Hunter NPC and Teleporter features with associated prefabs and effects
This commit is contained in:
@@ -11,12 +11,14 @@ namespace Infrastructure.Unity
|
||||
[SerializeField] private PowerUpType type;
|
||||
[SerializeField] private float duration = 10f;
|
||||
[SerializeField] private ParticleSystem pickupVfx;
|
||||
|
||||
[Self] [SerializeField] private MeshRenderer meshRenderer;
|
||||
|
||||
[Self][SerializeField] private MeshRenderer meshRenderer;
|
||||
|
||||
private MaterialPropertyBlock _propBlock;
|
||||
private static readonly int ColorProperty = Shader.PropertyToID("_BaseColor");
|
||||
|
||||
public event Action<PowerUpType> OnCollected;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_propBlock = new MaterialPropertyBlock();
|
||||
@@ -33,6 +35,12 @@ namespace Infrastructure.Unity
|
||||
case PowerUpType.SpeedBoost:
|
||||
SetColor(EffectColors.SpeedBoostColor);
|
||||
break;
|
||||
case PowerUpType.Hover:
|
||||
SetColor(EffectColors.HoverColor);
|
||||
break;
|
||||
case PowerUpType.TimeSlow:
|
||||
SetColor(EffectColors.TimeSlowColor);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
@@ -43,13 +51,14 @@ namespace Infrastructure.Unity
|
||||
if (other.TryGetComponent<PlayerController>(out var player))
|
||||
{
|
||||
ApplyEffect(player);
|
||||
|
||||
OnCollected?.Invoke(type);
|
||||
|
||||
if (pickupVfx)
|
||||
{
|
||||
var vfx = Instantiate(pickupVfx, transform.position, Quaternion.identity);
|
||||
Destroy(vfx.gameObject, 2f);
|
||||
}
|
||||
|
||||
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +73,12 @@ namespace Infrastructure.Unity
|
||||
case PowerUpType.SpeedBoost:
|
||||
player.Status.AddEffect(new SpeedBoostEffect(duration, 1.5f));
|
||||
break;
|
||||
case PowerUpType.Hover:
|
||||
player.Status.AddEffect(new HoverEffect(duration));
|
||||
break;
|
||||
case PowerUpType.TimeSlow:
|
||||
// Handled globally
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
@@ -72,6 +87,7 @@ namespace Infrastructure.Unity
|
||||
public void Configure(PowerUpType newType)
|
||||
{
|
||||
type = newType;
|
||||
ConfigureVisuals();
|
||||
}
|
||||
|
||||
private void SetColor(Color color)
|
||||
|
||||
Reference in New Issue
Block a user