public bool GetAmmo(Ship ship, Map map, out LaserType a, out RocketType r, out HellstormType h) { a = ((this.DefaultLaser == LaserType.Default) ? LaserType.LCB_10 : this.DefaultLaser); r = this.DefaultRocket; h = this.DefaultHellstorm; if (!ship.IsNpc && !map.IsGG) { return(false); } SelectedNpcModel model = this.GetModel(ship, map, null, 0); if (model == null) { if (!map.IsGG) { return(false); } } else { a = ((model.Laser == LaserType.Default) ? a : model.Laser); r = ((model.Rocket == RocketType.Default) ? r : model.Rocket); h = ((model.Hellstorm == HellstormType.Default) ? h : model.Hellstorm); bool flag; if (map.method_8(ship, out flag) && model.GgCornerLaser != LaserType.Default) { a = model.GgCornerLaser; } else if (model.UseSab && ship.Shield >= 2000 && map.Hero.ShieldPercentage <= (float)this.MinSabShield && map.Hero.method_21("ammunition_laser_sab-50") > 100.0 && map.Hero.Formation != GEnum4.Moth) { a = LaserType.SAB_50; } } return(true); }
public Rocket(int playerId, RocketType type, Vector2 target) { this.playerId = playerId; this.type = type; this.state = RocketState.Idle; this.target = target; this.velocity = Vector2.Zero; this.acc = Vector2.Zero; this.angle = 0f; this.airFrictionCoeff = 0f; this.cruiseAltitude = 0f; this.impact = false; switch (type) { case RocketType.Thor4: this.airFrictionCoeff = 0.002f; this.cruiseAltitude = -60f; break; case RocketType.Scout8: this.airFrictionCoeff = 0.002f; this.cruiseAltitude = -40f; break; case RocketType.Northstar10: this.airFrictionCoeff = 0.002f; this.cruiseAltitude = -80f; break; } }
// Update is called once per frame void Update() { FrameCount += 1; if (Input.GetKeyDown(FireSimple)) { //Debug.Log("Spawn rocket request..."); Spawn(rocketType); } if (Input.GetKeyUp(ChangeRockeType)) { if (rocketType == RocketType.Simple) { rocketType = RocketType.Guided; } else { rocketType = RocketType.Simple; } //Debug.Log("Now Spawning: " + rocketType.ToString()); } fireCountDown -= Time.deltaTime; if (fireCountDown < 0) { Spawn(rocketType); fireCountDown = Random.Range(intervalRangeMin, intervalRangeMax); } }
public async Task <IActionResult> Edit(int id, [Bind("rocketTypeID,width,height,rocketignitor,rocketPropellant")] RocketType rocketType) { if (id != rocketType.rocketTypeID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rocketType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RocketTypeExists(rocketType.rocketTypeID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(rocketType)); }
public override void OnUpdate(Scene scene) { if (Time.time > this.m_NextLaunch) { this.m_NextLaunch = Time.time + this.m_Random.Next(5, 15) * 0.5f; this.m_FoundTarget = false; scene.world.ForEach(this.m_Query, FindTargetTile); double rand = this.m_Random.NextDouble(); RocketType type = RocketType.Thor4; if (rand < 0.5f) { type = RocketType.Thor4; } else if (rand < 0.85f) { type = RocketType.Scout8; } else { type = RocketType.Northstar10; } var entity = scene.world.CreateEntity(this.m_Arch); var spawn = RocketMission.launchLocations[PlayerAI.playerId] + new Vector2(10f, -10f); scene.world.SetComponentData <Position>(entity, new Position(spawn)); scene.world.SetComponentData <Rocket>(entity, new Rocket(PlayerAI.playerId, type, this.m_TargetPosition)); } }
public RocketType[] GetAvailableRocketTypes() { var result = new RocketType[rockets.Count]; rockets.Keys.CopyTo(result, 0); return(result); }
private void GeneratePlanets(bool isLoadRequest = false, GameState gameState = null) { for (int i = 0; i < totalPlanets; i++) { GameObject planet = Instantiate(gameConfig.planetPrefab); planet.name = "Planet " + i; PlanetState planetState; if (isLoadRequest) { planetState = gameState.planetsStates[i]; } else { RocketType rocketType = ComputationalFunctions.getRandomRocketType(); int matIndex = randomMaterialsOrder[i]; Color col = i > 0 ? gameConfig.enemyColor : gameConfig.playerColor; Vector3 pos = ComputationalFunctions.getRandomPositionOnOrbit(randomOrbitsOrder[i], totalPlanets, gameConfig.distanceBetweenOrbits); float HP = gameConfig.planetMaxHP; float RT = GetRocketReloadCooldown(rocketType); planetState = new PlanetState(rocketType, matIndex, col, pos, HP, RT); } planet.GetComponent <PlanetManager>().Initialize(planetState); planets.Add(planet); } }
public void BuildRocket(RocketType rocketType) { Planet currPlanet = PlayerStatController.instance.currentPlanet; //Check if the planet has enough space for a new rocket if (!currPlanet.isRocketCapacityFull()) { //Queue //Begin construction of a rocket RocketPanelForQueue panel = Instantiate(rocketPanelForQueue, queuePanel.transform).GetComponent <RocketPanelForQueue>(); //Add rocket to queue RocketQueueItem newRocket = new RocketQueueItem(); newRocket.constructionTime = 10; newRocket.rocketType = rocketType; currPlanet.rocketConstructionQueue.Add(newRocket); currPlanet.constructingRockets++; panel.rocketQueueItem = newRocket; panel.SetText(); } //Rocket Capacity Full else { Debug.Log("Rocket Capacity Full!"); } }
public RocketController this[RocketType type] { get { Init(); return(dictionary[type]); } }
public PlanetState(RocketType rocketType, int matIndex, Color contrCol, Vector3 pos, float curHP, float curRT) { this.rocketType = rocketType; this.matIndex = matIndex; this.contrCol = contrCol; this.pos = pos; this.curHP = curHP; this.curRT = curRT; }
protected virtual void LaunchRocket(RocketType rocketType) { if (CheckLaunchPossible()) { float coolDown = rocketLaunchSystem.InitiateLaunch(this, rocketType, GetRocketSendDirection()).GetRocketCooldown(); stats.Cooldown = coolDown; CooldownChanged?.Invoke(coolDown); } }
public void Spawn(RocketType type) { var rocket = RocketFactory.CreateRocket(type); rocket.transform.position = gameObject.transform.position; rocket.GetComponent <Rocket>().Initialize(type, Target); audioSource.PlayOneShot(SoundFX.MissileLaunch); //Debug.Log("Rocket Spaned!!!!"); }
public void HitByOther() { Target = null; rocketType = RocketType.HitByOther; rb.velocity = rb.velocity * -2; explodeInSec = 3f; destroyInSec = 5 + explodeInSec; }
public void Initialize(PlanetState planetState) { this.transform.position = planetState.pos; this.planetMatIndex = planetState.matIndex; this.rocketType = planetState.rocketType; this.controllerColor = planetState.contrCol; this.currentHP = planetState.curHP; this.currentReloadCooldown = planetState.curRT; updatePlanetValues(); }
public void CreateRocket(RocketType rocketType, Transform planet, Vector3 direction) { var newRocket = Instantiate(rocketCollection[rocketType]); newRocket.transform.position = planet.position; newRocket.gameObject.transform.SetParent(rocketParent.transform); newRocket.Initialize(direction, planet.gameObject); existedRockets.Add(newRocket); }
public void Init(float maxHealth, RocketType rocketType) { RocketData rocketData = new RocketData(); RocketCharacteristics rocketCharacteristics = rocketData.GetCharacteristics(rocketType); countdown = rocketCharacteristics.Cooldown; rocketImageButton.sprite = rocketCharacteristics.sprite; rocketButton.onClick.AddListener(ClickRocketButton); healthBarSlider.maxValue = maxHealth; healthBarSlider.value = maxHealth; }
public async Task <IActionResult> Create([Bind("rocketTypeID,width,height,rocketignitor,rocketPropellant")] RocketType rocketType) { if (ModelState.IsValid) { _context.Add(rocketType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(rocketType)); }
public void Init(RocketType rocketType, float currentHealth, bool isMain = false) { if (isMain) { MainParticle.SetActive(true); } this.currentHealth = currentHealth; this.rocketType = rocketType; rocketCharacteristics = rocketData.GetCharacteristics(rocketType); ellipseHelper = new Ellipse(); }
public RocketProvider GetRocketPrefab(RocketType rocketType) { for (int i = 0; i < _rocketsPrefabs.Length; i++) { if (_rocketsPrefabs[i].RocketType == rocketType) { return(_rocketsPrefabs[i]); } } return(null); }
public Rocket InitiateLaunch(Player initiator, RocketType rocketName, Vector3 direction) { RocketParameters parameters = GM.RocketTypes.GetRocketParameters(rocketName); Rocket newRocket = GameObject.Instantiate(parameters.prefab, initiator.transform.position + direction * initiator.transform.localScale.x, Quaternion.LookRotation(direction, Vector3.back)).AddComponent <Rocket>(); newRocket.OverwriteProperties(parameters); newRocket.LauncherPlanet = initiator.gameObject; return(newRocket); }
public Cannon( Transform transform, float reloadingTime, RocketType rocketType, RocketsFactory rocketsFactory ) { _transform = transform; _reloadingTime = reloadingTime; RocketType = rocketType; _rocketsFactory = rocketsFactory; }
private void CheckUserInput(string userRocketType) { if (RocketValidation.IsRocketTypeValid(userRocketType)) { RocketType rocketType = (RocketType)Enum.Parse(typeof(RocketType), userRocketType); _rocketFactory.AddRocket(rocketType); } else { _consoleSystem.Write($"There is no rocket with the type: {userRocketType}"); } }
public void Initialize(RocketType type, GameObject target) { initialRocketType = type; rocketType = type; Target = target; rb.velocity = (Target.transform.position - transform.position).normalized * speed; transform.rotation = Quaternion.LookRotation(rb.velocity) * Quaternion.Euler(rocketRotation); audioSource.clip = SoundFX.MissileTravel; audioSource.loop = true; audioSource.Play(); }
public static GameObject CreateRocket(RocketType type) { var rocket = Instance.factory[type].GetObject(); if (rocket == null) { rocket = Instantiate(Instance.RocketPrefabs[0], Instance.graveyardPosition, Quaternion.identity); Instance.factory[type].Add(rocket); } rocket.SetActive(true); return(rocket); }
private void CheckUserInput(string userRocketType, string userRocketAmount) { if (RocketValidation.IsRocketTypeValid(userRocketType)) { RocketType rocketType = (RocketType)Enum.Parse(typeof(RocketType), userRocketType); int amount = int.Parse(userRocketAmount); int amontRoketlaunch = _battery.LaunchFewRockets(rocketType, amount); _consoleSystem.Write($"the rocket amount success to launch: {amontRoketlaunch.ToString()}"); } else { _consoleSystem.Write($"There is no rocket with the type: {userRocketType}"); } }
public int LaunchFewRockets(RocketType rocketType, int amount) { List <IRocket> rockets = new List <IRocket>(); List <IRocket> rocketsByType = _allRockets.Where(r => r.RocketType == rocketType).ToList(); if (rocketsByType.Count() >= amount) { rockets = LaunchRocket(rocketsByType.Take(amount).ToList()); RemoveFromList(rockets); return(rockets.Count()); } return(0); }
public static bool HasEnoughForRocket(RocketType type) { switch (type) { case RocketType.Thor4: return(derylium >= 20 && ziklium >= 10); case RocketType.Scout8: return(derylium >= 30 && ziklium >= 25); case RocketType.Northstar10: return(derylium >= 45 && ziklium >= 30); } return(false); }
private void SetRocketPool(RocketType type) { switch (type) { case RocketType.Blue: currentPool = rocketBluePool; break; case RocketType.Green: currentPool = rocketGreenPool; break; case RocketType.Yellow: currentPool = rocketYellowPool; break; } }
public RocketCharacteristics GetCharacteristics(RocketType rocketType) { switch (rocketType) { case RocketType.Small: return(new RocketCharacteristics { Acceleration = 2.2f, Weight = 0.4f, Cooldown = 3, Damage = 25, sprite = Resources.Load <Sprite>(GameData.ROCKET0_SPRITE_PATH) }); case RocketType.Middle: return(new RocketCharacteristics { Acceleration = 2f, Weight = 0.5f, Cooldown = 2, Damage = 40, sprite = Resources.Load <Sprite>(GameData.ROCKET1_SPRITE_PATH) }); case RocketType.Big: return(new RocketCharacteristics { Acceleration = 1.5f, Weight = 0.6f, Cooldown = 1, Damage = 50, sprite = Resources.Load <Sprite>(GameData.ROCKET2_SPRITE_PATH) }); default: return(new RocketCharacteristics { Acceleration = 3, Weight = 1, Cooldown = 3, Damage = 20, sprite = Resources.Load <Sprite>(GameData.ROCKET0_SPRITE_PATH) }); } }
public void SetRocketAmmo(RocketType type, int ammo) { switch (type) { case RocketType.Normal: normalRocket.SetAmmo(ammo); break; case RocketType.Fast: fastRocket.SetAmmo(ammo); break; case RocketType.Deadly: deadlyRocket.SetAmmo(ammo); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }