Felix Boucher 22abe69340 tidy up level manager related scripts
scripts were not classified

created a LevelManager folder in the scripts folder
2023-05-20 22:42:03 -04:00

42 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
[CreateAssetMenu(menuName = "Gather And Defend/Resource Tile")]
public class ResourceTile : TileBase
{
public class ResourceTileData : ILevelObject
{
private Vector3 _position;
private string _resourceType;
public Vector3 Position => _position;
public string ResourceType => _resourceType;
public ResourceTileData(Vector2 position, string resourceType)
{
this._position = position;
this._resourceType = resourceType;
}
}
[SerializeField]
private Sprite _sprite;
public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
{
if (!Application.isPlaying) return base.StartUp(position, tilemap, go);
if (position == new Vector3Int(-5, -5))
{
Debug.Log("Yo");
}
LevelManager.Instance.Add(new ResourceTileData((Vector3)position, name));
return base.StartUp(position, tilemap, go);
}
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
{
tileData.sprite = _sprite;
tileData.transform.SetTRS(Vector3.zero, Quaternion.identity, Vector3.one);
tileData.color = Color.white;
}
}