-
Notifications
You must be signed in to change notification settings - Fork 0
/
Effect.cs
37 lines (30 loc) · 1.06 KB
/
Effect.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
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK;
using Engine;
namespace U5Designs {
/// <summary>
/// Effects are Decorations which play their animation a single time and then delete themselves
/// </summary>
public class Effect : Decoration {
PlayState playstate;
double timeElapsed;
public Effect(PlayState ps, Vector3 location, Vector3 scale, bool existsIn2d, bool existsIn3d, Billboarding bb, SpriteSheet sprite)
: base(location, scale, existsIn2d, existsIn3d, bb, sprite) {
this.playstate = ps;
timeElapsed = 0.0;
}
public Effect(Vector3 location, Effect template)
: this(template.playstate, location, template.scale, template.existsIn2d, template.existsIn3d, template.billboards, template.sprite) { }
public void update(double time) {
timeElapsed += time;
if(timeElapsed >= sprite.frameCount / sprite.framesPerSecond) {
playstate.objList.Remove(this);
playstate.renderList.Remove(this);
playstate.effectsList.Remove(this);
}
}
}
}