1
Fork 0
mirror of https://github.com/Steffo99/octogem.git synced 2024-11-22 04:54:18 +00:00
octogem/Assets/Scripts/Components/Tile.cs

44 lines
1 KiB
C#

using System.Collections.Generic;
using UnityEngine;
public class Tile : MonoBehaviour
{
public TilePosition position;
public new TileRenderer renderer;
public List<GenericEffect> effectsOnStep;
public List<GenericEffect> effectsOnMove;
private TileType type;
void Awake()
{
position = GetComponent<TilePosition>();
renderer = GetComponent<TileRenderer>();
}
public TileType Type
{
get
{
return type;
}
set
{
type = value;
renderer.AnimatorController = type.AnimatorController;
effectsOnStep = type.effectsOnStep;
effectsOnMove = type.effectsOnMove;
}
}
public void SteppedOn(Unit walker)
{
effectsOnStep.ForEach(delegate (GenericEffect effect) { walker.ApplyNewEffect(effect); });
}
public void MovedOn(Unit walker)
{
effectsOnMove.ForEach(delegate (GenericEffect effect) { walker.ApplyNewEffect(effect); });
}
}