problem : tiles dont have an update loop, neither do they have a start / destroy method solution : finished working on a way to create a custom start/update/destroy pipeline for the projects custom tiles. it's using LevelManagerScript as to Update. note : also created a database and a start of serialization system so we can save and load stuff.
28 lines
779 B
C#
28 lines
779 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using static Extensions;
|
|
|
|
/// <summary>
|
|
/// can be inherited by MonoBehaviours in order to be added to the level manager
|
|
/// </summary>
|
|
public abstract class LevelObject : MonoBehaviour, ILevelObject
|
|
{
|
|
[LevelSerialize]
|
|
public Vector3 Position => transform.position;
|
|
[LevelSerialize]
|
|
public string Name => name;
|
|
|
|
void Awake()
|
|
{
|
|
if (LevelManager.Instance.Has<LevelObject>(obj => obj.Equals(this))) return;
|
|
|
|
LevelManager.Instance.Add(this);
|
|
}
|
|
|
|
public abstract void LevelStart();
|
|
public abstract void LevelDestroy();
|
|
public abstract void LevelUpdate();
|
|
|
|
public abstract bool Equals(ILevelObject other);
|
|
public abstract Dictionary<string, object> ToDictionary();
|
|
} |