-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathWindTrigger.cs
More file actions
95 lines (83 loc) · 3.05 KB
/
WindTrigger.cs
File metadata and controls
95 lines (83 loc) · 3.05 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using Microsoft.Xna.Framework;
using System.Collections.Generic;
namespace Celeste.Mod.IsaGrabBag
{
public class HotColdWind : Trigger
{
public WindController.Patterns windHot, windCold;
private bool freezeDreamBlocks;
private static bool current, dreamBlocksCurrent;
public HotColdWind(EntityData data, Vector2 offset) : base(data, offset)
{
windHot = data.Enum("patternHot", WindController.Patterns.Up);
windCold = data.Enum("patternCold", WindController.Patterns.Down);
freezeDreamBlocks = data.Bool("freezeDream", false);
}
public override void OnEnter(Player player)
{
base.OnEnter(player);
WindController.Patterns currentWind = current ? windHot : windCold;
SetWind(Scene, currentWind);
}
public override void OnStay(Player player)
{
base.OnStay(player);
if (SceneAs<Level>().CoreMode == Session.CoreModes.Hot != current)
{
current = !current;
WindController.Patterns currentWind = current ? windHot : windCold;
SetWind(Scene, currentWind);
}
}
public static void SetWind(Monocle.Scene scene, WindController.Patterns currentWind)
{
WindController wind = scene.Entities.FindFirst<WindController>();
if (wind == null)
{
wind = new WindController(currentWind);
scene.Add(wind);
return;
}
wind.SetPattern(WindController.Patterns.None);
wind.SetPattern(currentWind);
//if (_freeze)
//{
// List<DreamBlock> dreamblocks = scene.Entities.FindAll<DreamBlock>();
// Player player = scene.Entities.FindFirst<Player>();
// if (player != null)
// {
// (scene as Level).Session.Inventory.DreamDash = current;
// foreach (DreamBlock block in dreamblocks)
// {
// block.Added(scene);
// }
// }
//}
}
}
public class WindAgainstPlayer : Trigger
{
WindController.Patterns left, right;
public WindAgainstPlayer(EntityData data, Vector2 offset) : base(data, offset)
{
if (data.Attr("strongWind", "false").ToLower() == "true")
{
left = WindController.Patterns.LeftStrong;
right = WindController.Patterns.RightStrong;
}
else
{
left = WindController.Patterns.Left;
right = WindController.Patterns.Right;
}
}
public override void OnStay(Player player)
{
WindController.Patterns pattern = WindController.Patterns.None;
if (Input.MoveX != 0)
{
HotColdWind.SetWind(Scene, Input.MoveX > 0 ? left : right);
}
}
}
}