Starsector API
Loading...
Searching...
No Matches
CampaignEngineGlowUtil.java
Go to the documentation of this file.
1package com.fs.starfarer.api.util;
2
3import java.awt.Color;
4import java.util.ArrayList;
5import java.util.List;
6
7import com.fs.starfarer.api.campaign.SectorEntityToken;
8import com.fs.starfarer.api.util.CampaignEntityMovementUtil.EngineGlowControls;
9
10public class CampaignEngineGlowUtil implements EngineGlowControls {
11
12 public static String KEY1 = "key1";
13 public static String KEY2 = "key2";
14 public static String KEY3 = "key3";
15 public static String KEY4 = "key4";
16 public static String KEY5 = "key5";
17 public static String KEY6 = "key6";
18
20 protected SectorEntityToken entity;
21
33 private float shiftRate;
34
35 public CampaignEngineGlowUtil(SectorEntityToken entity,
36 Color fringe, Color core, Color flame, float shiftRate) {
37 this.entity = entity;
38 this.shiftRate = shiftRate;
41 flameColor = new ColorShifterUtil(flame);
42 }
43
45 engines.add(engine);
46 }
47
48
49 public void showOtherAction() {
50 glowMult.shift(KEY1, 1.5f, 1f, 1f, 1f);
51 lengthMult.shift(KEY1, 0.33f, 1f, 1f, 1f);
52 widthMult.shift(KEY1, 1f, 1f, 1f, 1f);
53 }
54 public void showAccelerating() {
55 glowMult.shift(KEY2, 1f, 1f, 1f, 1f);
56 lengthMult.shift(KEY2, 1f, 1f, 1f, 1f);
57 widthMult.shift(KEY2, 1f, 1f, 1f, 1f);
58// glowMult.shift(KEY2, 2f, 1f, 1f, 1f);
59// lengthMult.shift(KEY2, 2f, 1f, 1f, 1f);
60// widthMult.shift(KEY2, 2f, 1f, 1f, 1f);
61 }
62 public void showIdling() {
63 //if (true) {
64// if (Keyboard.isKeyDown(Keyboard.KEY_H)) {
65// showSuppressed();
66// return;
67// }
68// if (Keyboard.isKeyDown(Keyboard.KEY_J)) {
69// showOtherAction();
70// return;
71// }
72// if (Keyboard.isKeyDown(Keyboard.KEY_K)) {
73// showAccelerating();
74// return;
75// }
76
77 glowMult.shift(KEY3, 0.5f, 1f, 1f, 1f);
78 glowFringeMult.shift(KEY3, 1.5f, 1f, 1f, 1f);
79 lengthMult.shift(KEY3, 0.25f, 1f, 1f, 1f);
80 widthMult.shift(KEY3, 1.5f, 1f, 1f, 1f);
81
83 glowColorFringe.shift(KEY3, Color.black, 1f, 1f, 0.5f);
84 flameColor.shift(KEY3, Color.black, 1f, 1f, 0.75f);
85
86 //flickerMult.shift(KEY3, 0.5f, 1f, 1f, 1f);
87 }
88
89 public void showSuppressed() {
90 glowMult.shift(KEY4, 0.5f, 1f, 1f, 1f);
91 glowFringeMult.shift(KEY4, 0.5f, 1f, 1f, 1f);
92 lengthMult.shift(KEY4, 0.25f, 1f, 1f, 1f);
93 widthMult.shift(KEY4, 1f, 1f, 1f, 1f);
94
95// glowMult.shift(KEY4, 0.5f, 1f, 1f, 1f);
96// glowFringeMult.shift(KEY4, 1.5f, 1f, 1f, 1f);
97// lengthMult.shift(KEY4, 0.25f, 1f, 1f, 1f);
98// widthMult.shift(KEY4, 1.5f, 1f, 1f, 1f);
99
100 float in = 0.5f;
101 if (lengthMult.getCurr() <= 0f || widthMult.getCurr() <= 0f) {
102 in = 0f;
103 }
104 glowColorCore.shift(KEY4, Color.black, in, 1f, 1f);
105 glowColorFringe.shift(KEY4, Color.black, in, 1f, 1f);
106 flameColor.shift(KEY4, Color.black, in, 1f, 1f);
107 }
108
109
131
132
133 public void render(float alphaMult) {
135 engine.render(entity.getLocation(), entity.getFacing(), alphaMult);
136 }
137 }
138
140 return glowMult;
141 }
142
144 return lengthMult;
145 }
146
148 return widthMult;
149 }
150
154
156 return glowColorCore;
157 }
158
162
164 return flameColor;
165 }
166
168 return flickerMult;
169 }
173
175 return glowCoreMult;
176 }
177
181
182}
183
184
185
186
187
188
189
190
void addEngine(CampaignEngineGlowIndividualEngine engine)
CampaignEngineGlowUtil(SectorEntityToken entity, Color fringe, Color core, Color flame, float shiftRate)
List< CampaignEngineGlowIndividualEngine > engines
void shift(Object source, Color to, float durIn, float durOut, float shift)
void shift(Object source, float to, float durIn, float durOut, float shift)