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

45 lines
1 KiB
C#
Raw Normal View History

2018-09-30 14:35:17 +00:00
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); });
}
}