-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNote.cs
More file actions
73 lines (64 loc) · 1.84 KB
/
Note.cs
File metadata and controls
73 lines (64 loc) · 1.84 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using FunkEngine;
using Godot;
/**
* <summary>Note: Data structure class for holding data and methods for a battle time note.</summary>
*/
public partial class Note : Resource, IDisplayable
{
public PuppetTemplate Owner;
public int Id;
public string Name { get; set; }
private int _baseVal;
public float CostModifier { get; private set; }
public Targetting TargetType { get; private set; }
private Action<BattleDirector, Note, Timing> NoteEffect;
public const double TimingMax = 0.5d; //The max range for a note to be timed is its beat +/- this const
public Texture2D Texture { get; set; }
public Note(
int id,
string name,
Texture2D texture = null,
int baseVal = 1,
Action<BattleDirector, Note, Timing> noteEffect = null,
float costModifier = 1.0f,
Targetting targetType = Targetting.First
)
{
Id = id;
Name = name;
NoteEffect = noteEffect;
_baseVal = baseVal;
Texture = texture;
CostModifier = costModifier;
TargetType = targetType;
}
public void OnHit(BattleDirector BD, Timing timing)
{
NoteEffect(BD, this, timing);
}
public Note SetOwner(PuppetTemplate owner)
{
Owner = owner;
return this;
}
public Note Clone()
{
//Eventually could look into something more robust, but for now shallow copy is preferable.
//We only would want val and name to be copied by value
Note newNote = new Note(Id, Name, Texture, _baseVal, NoteEffect, CostModifier, TargetType);
return newNote;
}
public bool IsPlayerNote()
{
return Name.Contains("Player");
}
public int GetBaseVal()
{
return _baseVal;
}
public void SetBaseVal(int val)
{
_baseVal = val;
}
}