Skip to content

Commit d4f9e3e

Browse files
committed
Fixed construction effects and missile offsets
- construction effects on defense and tesla are now 1 round shorter to compensate for looking like they are hit, while being constructed - Missiles from each no longer offset, they only offset to missiles from same player in a tile
1 parent e45bdb2 commit d4f9e3e

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

Assets/EC2018/BuildingController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void Setup (Building building) {
9494
if(timeLeft == 9) {
9595
GameObject obj = Instantiate (constructionAnimation);
9696
obj.transform.position = transform.position + obj.transform.position;
97-
Destroy (obj, 10f * gameSpeed);
97+
Destroy (obj, 9f * gameSpeed);
9898

9999
audioSource.clip = teslaConstruction;
100100
audioSource.pitch = Random.Range(0.7f, 1.3f);
@@ -104,7 +104,7 @@ public void Setup (Building building) {
104104
if(timeLeft == 2) {
105105
GameObject obj = Instantiate (constructionAnimation);
106106
obj.transform.position = transform.position + obj.transform.position;
107-
Destroy (obj, 3f * gameSpeed);
107+
Destroy (obj, 2f * gameSpeed);
108108

109109
audioSource.clip = defenseConstruction;
110110
audioSource.pitch = Random.Range(0.7f, 1.3f);

Assets/EC2018/GameStateManager.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,24 @@ void PopulateSceneFromGameMap() {
8888
var y = cell.Y;
8989

9090
instantiator.InstantiateBuildingsAtLocation(cell.Buildings, x, y);
91-
instantiator.InstantiateMissileAtLocation(cell.Missiles, x, y, rate);
91+
92+
//create list of player A missiles
93+
var missilesPlayerA = new List<Missile>();
94+
var missilesPlayerB = new List<Missile>();
95+
96+
//create list of player B missiles
97+
if(cell.Missiles.Count > 0) {
98+
for (int m = 0; m < cell.Missiles.Count; m++) {
99+
if(cell.Missiles[m].PlayerType == PlayerType.A) {
100+
missilesPlayerA.Add(cell.Missiles[m]);
101+
} else {
102+
missilesPlayerB.Add(cell.Missiles[m]);
103+
}
104+
}
105+
}
106+
107+
instantiator.InstantiateMissileAtLocation(missilesPlayerA, x, y, rate);
108+
instantiator.InstantiateMissileAtLocation(missilesPlayerB, x, y, rate);
92109

93110
if (currentRound == startRound) {
94111
instantiator.InstantiateGroundTile(inner, outer, cell.CellOwner);

Assets/EC2018/Instantiator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ private void InstantiateLightningHit(PlayerType originPlayer, GameObject start,
151151
Destroy(lightningBoltObj, CommandLineUtil.GetRoundStep());
152152

153153
var explosionToInstantiate = originPlayer == PlayerType.B ? explosionA : explosionB;
154-
Instantiate(explosionToInstantiate, start.transform.position, Quaternion.identity);
154+
var expObj = Instantiate(explosionToInstantiate, start.transform.position, Quaternion.identity);
155+
expObj.transform.localScale = expObj.transform.localScale * 0.5f;
155156
}
156157

157158
public void InstantiateTeslaHit(List<HitList> hitList, Player playerA, Player playerB) {

0 commit comments

Comments
 (0)