private void initAbils() { i = 1; foreach (int abil in planeTemplate.abilities) { //abilitiesGameObjects[i].SetActive(true); abilitiesGameObjects[i].GetComponent <SpriteRenderer>().sprite = Templates.AbilitiesIcons.getIcon((Abilities.AbilityType)abil, false); abilitiesGameObjects[i].transform.eulerAngles = forAbilities; i++; } if (Abilities.haveAbil(planeTemplate.abilities, Abilities.AbilityType.homingMissle)) { MisslePoolManager.getInstance().createPoolObjects(MissleSide.FRIENDLY, MissleType.ROCKET, 4); } if (Abilities.haveAbil(planeTemplate.abilities, Abilities.AbilityType.homingThorpede)) { MisslePoolManager.getInstance().createPoolObjects(MissleSide.FRIENDLY, MissleType.THORPEDE, 4); } if (Abilities.haveAbil(planeTemplate.abilities, Abilities.AbilityType.gas)) { MisslePoolManager.getInstance().createPoolObjects(MissleSide.FRIENDLY, MissleType.GAS, 60); } if (Abilities.haveAbil(planeTemplate.abilities, Abilities.AbilityType.mines)) { MisslePoolManager.getInstance().createPoolObjects(MissleSide.FRIENDLY, MissleType.MINES, 60); } }
public void toggleShowAllAttackIcons(MissleBehaviour exclude) { foreach (FriendlySpaceship obj in friendlySpaceships) { obj.showAttackIcon(); } MisslePoolManager.getInstance().ToggleShowAllAttackIcons(exclude); }
public void toggleOnZoomChangedEvent() { foreach (FriendlySpaceship obj in friendlySpaceships) { obj.onZoomChanged(); } MisslePoolManager.getInstance().ToggleOnZoomChanged(); }
private void DestroyedGas() { //explosionParticle.SetActive(true); //meshRender.enabled=false; this.transform.position = MisslePoolManager.getInstance().stackPos; exploded = true; GameStorage.getInstance().addToExplodeList(this); }
public static MisslePoolManager getInstance() { if (instance == null) { instance = new MisslePoolManager(); } return(instance); }
public void loadLevel(int level) { States.gamePhaseGuiEnabled = true; States.inPauseMenu = false; clearStorage(); BulletPoolManager.getInstance().initialize(); MisslePoolManager.getInstance().initialize(); UnityEngine.SceneManagement.SceneManager.LoadScene(Templates.getInstance().getLevel((int)States.currentCampaign.levels[level]).file); }
public void toggleShowAllAttackIcons(FriendlySpaceship exclude) { foreach (FriendlySpaceship obj in friendlySpaceships) { if (obj != exclude) { obj.showAttackIcon(); } } MisslePoolManager.getInstance().ToggleShowAllAttackIcons(null); }
//EVENTS public void toggleOnStepStart() { foreach (FriendlySpaceship obj in friendlySpaceships) { obj.onStepStart(); obj.hideAttackIcon(); } foreach (EnemySpaceship obj in enemySpaceships) { obj.onStepStart(); } MisslePoolManager.getInstance().ToggleOnStepStart(); }
private void Accelerates() { GameStorage.getInstance().processExplode(); if (States.WorldRunning) { GameStorage.getInstance().AccelerateAllUnits(); BulletPoolManager.getInstance().stepAllBullets(); MisslePoolManager.getInstance().MoveRocketsAndThorpeds(); if (Time.time >= GameStorage.getInstance().getEndTime()) { States.WorldRunning = false; GameStorage.getInstance().toggleOnStepEnd(); } } }
public void toggleOnStepEnd() { BulletPoolManager.getInstance().clearAllActiveBullets(); foreach (FriendlySpaceship obj in friendlySpaceships) { obj.onStepEnd(); obj.showAttackIcon(); } foreach (EnemySpaceship obj in enemySpaceships) { obj.onStepEnd(); } clearRemoveLists(); if (friendlySpaceships.Count == 0 || enemySpaceships.Count == 0) { CalculateWinLose(); } MisslePoolManager.getInstance().ToggleOnStepEnd(); checkZalpButtonState(); }
public void processExplode() { if (enemyExplodeList.Count > 0) { foreach (EnemySpaceship obj in enemyExplodeList) { if (obj.Explode()) { enemyExplodeListToRemove.Add(obj); } } if (enemyExplodeListToRemove.Count > 0) { foreach (EnemySpaceship obj in enemyExplodeListToRemove) { enemyExplodeList.Remove(obj); } enemyExplodeListToRemove.Clear(); } } if (friendlyExplodeList.Count > 0) { foreach (FriendlySpaceship obj in friendlyExplodeList) { if (obj.Explode()) { friendlyExplodeListToRemove.Add(obj); } } if (friendlyExplodeListToRemove.Count > 0) { foreach (FriendlySpaceship obj in friendlyExplodeListToRemove) { friendlyExplodeList.Remove(obj); } friendlyExplodeListToRemove.Clear(); } } if (rocketExplodeList.Count > 0) { foreach (MissleBehaviour obj in rocketExplodeList) { if (obj.Explode()) { rocketExplodeListToRemove.Add(obj); } } if (rocketExplodeListToRemove.Count > 0) { foreach (MissleBehaviour obj in rocketExplodeListToRemove) { rocketExplodeList.Remove(obj); if (obj.type == MissleType.ROCKET) { MisslePoolManager.getInstance().DestroyRocket(obj); } if (obj.type == MissleType.THORPEDE) { MisslePoolManager.getInstance().DestroyThorpede(obj); } if (obj.type == MissleType.MINES) { MisslePoolManager.getInstance().DestroyMine(obj); } if (obj.type == MissleType.GAS) { MisslePoolManager.getInstance().DestroyGas(obj); } } rocketExplodeListToRemove.Clear(); } } }
public static MisslePoolManager getInstance() { if(instance==null) instance=new MisslePoolManager(); return instance; }
public void STEP() { if (!exploded) { if (!Abilities.getLockGun(activeAbil)) { foreach (Templates.GunOnShuttle gun in planeTemplate.guns) { gunTemp = Templates.getInstance().getGunTemplate(gun.gunId); if (!gun.ready) { if (gun.shotTime + gunTemp.reuse < Time.time) { gun.ready = true; } } enemy = GameStorage.getInstance().getEnemyInFireZone(this, gun); if (gun.ready && enemy != null) { //SHOT PROCEDURE WITH POOLING f = Quaternion.Euler(0, 0, -gameObject.transform.eulerAngles.y) * gun.pos; BulletPoolManager.getInstance().shotBullet(BulletSide.FRIENDLY, new Vector3(transform.position.x + f.x, 5, transform.position.z + f.y), enemy.transform.position, gunTemp.damage, gunTemp.bulletSpeed, gunTemp.gunType, gunTemp.attackRange, gunTemp.bulletDispersion); gun.ready = false; gun.shotTime = Time.time; } } } if (underGas) { if (Time.time >= lastGasBurned + Abilities.GasParameters.gasReuse) { Attacked(Abilities.GasParameters.gasDamage); lastGasBurned = Time.time; } } t += 1f / 151f; x = (1 - t) * (1 - t) * (1 - t) * point1.x + 3 * (1 - t) * (1 - t) * t * point2.x + 3 * (1 - t) * t * t * point3.x + t * t * t * point4.x; y = (1 - t) * (1 - t) * (1 - t) * point1.y + 3 * (1 - t) * (1 - t) * t * point2.y + 3 * (1 - t) * t * t * point3.y + t * t * t * point4.y; tmpVec.x = x; tmpVec.y = 5; tmpVec.z = y; curDistance += Vector3.Distance(forDist, tmpVec); if (activeAbil == Abilities.AbilityType.halfRoundTurn) { f2tmp = transform.eulerAngles.y + abilRandonRotateDirection * 180 * Time.fixedDeltaTime / 3; } else if (activeAbil == Abilities.AbilityType.turnAround) { f2tmp = transform.eulerAngles.y + abilRandonRotateDirection * 360 * Time.fixedDeltaTime / 3; } else { v2tmp1.x = x - transform.position.x; v2tmp1.y = y - transform.position.z; v2tmp2 = new Vector2(0, 5); f1tmp = (v2tmp2.x * v2tmp1.y - v2tmp2.y * v2tmp1.x); f2tmp = Vector2.Angle(v2tmp2, v2tmp1); if (f1tmp > 0) { f2tmp = (180 - f2tmp) + 180; } } if (activeAbil == Abilities.AbilityType.homingMissle && t >= 0.5f && !rocketLaunched) { MisslePoolManager.getInstance().LaunchRocket(MissleSide.FRIENDLY, this); rocketLaunched = true; } else if (activeAbil == Abilities.AbilityType.homingThorpede && t >= 0.5f && !rocketLaunched) { MisslePoolManager.getInstance().LaunchThorpede(MissleSide.FRIENDLY, this); rocketLaunched = true; } else if (activeAbil == Abilities.AbilityType.gas) { if (curDistance >= gasLastSpawnDist) { MisslePoolManager.getInstance().LaunchGas(MissleSide.FRIENDLY, this); gasLastSpawnDist = curDistance + Abilities.GasParameters.betweenDist; } } else if (activeAbil == Abilities.AbilityType.mines) { if (curDistance >= gasLastSpawnDist) { MisslePoolManager.getInstance().LaunchMine(MissleSide.FRIENDLY, this); gasLastSpawnDist = curDistance + Abilities.MinesParameters.betweenDist; } } transform.eulerAngles = new Vector3(270, f2tmp, 0); //Debug.Log("ALLY: "+f2tmp); fortestAngle = f2tmp; transform.position = tmpVec; forDist = transform.position; } }