-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseTemplate.cs
36 lines (30 loc) · 1.11 KB
/
BaseTemplate.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using NeonLib.Events;
using NeonLib.Variables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NeonLib.Templates {
public abstract class BaseTemplate : ScriptableObject {
public GameEvent OnTemplateActivated;
public GameEvent OnTemplateDeactivated;
public ScriptableVariable IsActive;
// Add any common methods or properties for base templates here
//Override and call base.Activate(currentObject) to implement overwriting the values of the given object
public virtual void Activate(object currentObject) {
if (IsActive != null) {
IsActive.Value = true;
}
OnTemplateActivated?.Invoke();
}
//Override and call base.Deactivate(currentObject) to implement custom behavior to clean up the object
public virtual void Deactivate(object currentObject) {
if (IsActive != null) {
IsActive.Value = false;
}
OnTemplateDeactivated?.Invoke();
}
}
}