IEnumerator SetRocketTarget(Rocket rocket, SpacePlayer target) { yield return false; rocket.SetTarget(target.networkView.owner); rocket.networkView.RPC("SetTarget", RPCMode.Others, target.networkView.owner); }
public void RocketHit( Rocket rocket, float hitDamage ) { if ( !hit ) { hit = true; rigidbody.drag = 0f; rocket.player.Score = rocket.player.Score + 1; StartCoroutine( Explode() ); } }
public void Release() { if (prefab != null) { gameObject.SetActive(false); next = prefab.next; prefab.next = this; } else if (gameObject) { Destroy(gameObject); } }
public bool FireRocket(Rocket rocket) { float cost = rocket.EnergyCost(); if (mEnergy >= cost) { mEnergy -= cost; return true; } return false; }
public void Execute(Rocket.Unturned.Player.RocketPlayer caller, string[] command) { DateTime currenttime = DateTime.Now; DateTime delaytime; //ushort id2 = ushort.Parse(command[0]); // TODO how does this differ from GetUInt16Parameter() ? ushort? id = RocketCommandExtensions.GetUInt16Parameter(command, 0); int? count = RocketCommandExtensions.GetInt32Parameter(command, 1); float? delay = RocketCommandExtensions.GetFloatParameter(command, 2); // if ((command.Length < 3 && caller == null) || (command.Length < 3 && caller.HasPermission("advancedeffect"))) if (command.Length < 3 && (caller.HasPermission("advancedeffect") || caller == null || caller.IsAdmin)) { RocketChat.Say(caller, "missing parameters! command usage: <id> <amount of times> <delay between effects>"); } else if (command.Length == 3 && (caller == null || caller.IsAdmin || caller.HasPermission("advancedeffect"))) { for (int ii = 1; ii <= count.Value; ii++) { delaytime = currenttime.AddMilliseconds(delay.Value); bool doloop = true; while (doloop) { continuelooping: currenttime = DateTime.Now; if (currenttime >= delaytime) { // caller.TriggerEffect(id.Value); Logger.Log("the time comparison worked!"); doloop = false; } else { goto continuelooping; } } } } else { if (caller == null) { Logger.Log("u dont have permission to use this command!"); } else { RocketChat.Say(caller, "u dont have permission to use this command!"); } } }
public void FireRocket(Rocket prefab, float speed) { if (!mRefillGUI.FireRocket(prefab)) { return; } Vector3 position = transform.position; Quaternion rotation = Quaternion.Euler (0f, mRotZ, 0f); Rocket rocket = Instantiate(prefab, position, rotation) as Rocket; Body body = transform.parent.gameObject.GetComponent<Planet>(); Vector2 velocity = body.Velocity; velocity.x += Mathf.Cos(Mathf.Deg2Rad * mRotZ) * speed; velocity.y += Mathf.Sin(Mathf.Deg2Rad * mRotZ) * speed; rocket.SetInitialVelocity(velocity); audio.PlayOneShot(mSoundLaunch); }
//-------------------------------------------------------------------------------- // OBJECT POOL //-------------------------------------------------------------------------------- public Rocket Alloc(Vector2 position, Vector2 heading) { Assert(IsPrefab); Rocket result; if (next != null) { // RECYCLE INSTANCE result = next; next = result.next; result.next = null; result.xform.position = position; result.gameObject.SetActive(true); } else { // CREATE NEW INSTANCE result = Dup(this, position); result.prefab = this; } // RE-INIT INSTANCE result.Init(heading.normalized); return result; }
private void PrecreateObjects(int amount) { rocketPool = new Queue <Rocket>(); rocketObjects = new List <GameObject>(); for (int i = 0; i < amount; i++) { GameObject go = GameObject.Instantiate(rocketPrefab) as GameObject; Rocket bul = go.GetComponent <Rocket>(); bul.SetManager(this); bul.SetTeam(team); if (bul == null) { Debug.LogError("Cannot fint the component Rocket in the rocket prefab."); } go.name = "Rocket"; go.SetActive(false); rocketPool.Enqueue(bul); rocketObjects.Add(go); IgnoreColliders(go.GetComponent <BoxCollider2D>()); } }
public override void CreateScene() { lvl = new Level("levels/test-level.xml", null, PlaneType.P47); lvlView = new LevelView(this, null); lvlView.OnRegisterLevel(lvl); //Wof.Model.Level.Planes.Plane p = new Wof.Model.Level.Planes.Plane(); //lvlView.OnRegisterPlane(p); Rocket rock = new Rocket(new PointD(150, 5), new PointD(0, 0), lvl, Math.PI / 4, null); Bomb bomb = new Bomb(new PointD(150.1f, 5), new PointD(0, 0), lvl, Math.PI / 4, null); Rocket rock2 = new Rocket(new PointD(300, 5), new PointD(0, 0), lvl, 0, null); Bomb bomb2 = new Bomb(new PointD(151.1f, 5), new PointD(0, 0), lvl, Math.PI / 4, null); lvlView.OnRegisterAmmunition(rock); lvlView.OnRegisterAmmunition(bomb); lvlView.OnRegisterAmmunition(rock2); lvlView.OnRegisterAmmunition(bomb2); //EnemyInstallationTile eit = (EnemyInstallationTile)lvl.LevelTiles[112]; //Soldier soldier = new Soldier(0, Direction.Left, lvl, 0, Soldier.SoldierType.SOLDIER); //lvlView.OnRegisterSoldier(soldier); // , lvl.LevelTiles[112]);*/ //eit.Destroy(); //Soldier soldier = new Soldier(0, Direction.Left, lvl); //lvlView.OnRegisterSoldier(soldier);// , lvl.LevelTiles[112]); }
void Update() { // Update mouse direction mouseDir = (Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position).normalized; // Fire rocket on click if (Input.GetButton("Shoot") && canFireRocket && !PauseMenu.Singleton.IsPaused) { // Start rocket cooldown StartCoroutine(RocketCooldown()); // Spawn rocket Rocket rocket = Instantiate(rocketPrefab, transform.position, Quaternion.identity); rocket.Direction = mouseDir; // Apply recoil force to player playerBody.AddForce(recoilStrength * -mouseDir, ForceMode2D.Impulse); // Invoke onShoot event onShoot.Invoke(); } }
// The method for shooting a rocket. private void ShootRocket() { // Gather an angle using trigonometry, based on the current velocity of the player. float angle = Mathf.Atan2(playerRigidbody.velocity.y, playerRigidbody.velocity.x) * Mathf.Rad2Deg - 90f; // Instantiate a new instance of the rocket, rotated at the angle we calculated earlier. GameObject instance = Instantiate(rocketPrefab, transform.position, Quaternion.AngleAxis(angle, Vector3.forward)); // Get the rocket data component of the instance. // Rocket data is a custom script to store information regarding the rocket, // most importantly it's sender. Rocket rocketData = instance.GetComponent <Rocket>(); // Set the rocket data sender to be this gameobject. rocketData.sender = this.gameObject; // Set the rocket data death timer to be the value we provided in this script. rocketData.deathTimer = rocketLifespan; // Start the rocket death timer, // so that it will explode after a given amount of time without contact. rocketData.StartDeathTimer(); // Please note that once the rocket is destroyed, either by contact or by death timer, // it must call the Reset method in this componenet of it's sender. See RocketData.cs, // line 11. }
private void OnTriggerEnter(Collider other) { if (other.tag == "PlayerRocket") { Rocket rocket = other.GetComponent <Rocket>(); if (rocket != null) { m_life -= rocket.m_power; if (m_life <= 0) { Destroy(this.gameObject); Instantiate(m_explosionFX, transform.position, Quaternion.identity); GameManager.Instance.AddScore(m_point); } } } else if (other.tag == "Player") { m_life = 0; Destroy(this.gameObject); } }
private static void StartMoving(PictureBox rocket_pb, PictureBox cosmonaut_pb, PictureBox insurance_pb, PictureBox bg_pb, Panel panel) { panel.Invoke(new MethodInvoker(() => panel.Visible = true)); Rocket rocket = new Rocket(); //движение ракеты Thread moveRocketThread = new Thread(new ParameterizedThreadStart(Utils.MoveObjectRocket)); ClassForMove objRocket = new ClassForMove(rocket, rocket_pb, bg_pb, NearestCount1, NearestCount2); moveRocketThread.Start(objRocket); //выход космонавтов Thread moveCosmonautThread = new Thread(new ParameterizedThreadStart(Utils.CheckSuccesfullStart)); ClassForMove objCosmonaut = new ClassForMove(rocket, cosmonaut_pb, bg_pb, NearestCount1, NearestCount2); moveCosmonautThread.Start(objCosmonaut); //выплата страховки Insurance insurance = new InsuranceRocket(); Thread insuranceThread = new Thread(new ParameterizedThreadStart(Utils.CheckCrashStatus)); ClassForMove objInsurance = new ClassForMove(rocket, insurance_pb, bg_pb, NearestCount1, NearestCount2); insuranceThread.Start(objInsurance); }
void MenuExecuted(Module modulePrefab) { if (modulePrefab != null) { Module module = Instantiate(modulePrefab); AttachmentPoint attachmentPoint = module.FindAttachmentPoint(AttachmentFacingDirection.SOUTH); if (attachmentPoint == null) { DestroyImmediate(module.gameObject); print("Could not find a southward attachmentpoint, needed for starting object"); } else { module.name = "Rocket"; Rocket rocketComponent = module.gameObject.AddComponent <Rocket> (); module.transform.Translate(-attachmentPoint.transform.localPosition); launchButton.onClick.AddListener(rocketComponent.Launch); cameraHandler.track = module.gameObject; DestroyImmediate(this.gameObject); } } }
public void RocketFly(ref Rocket rocket) { switch (rocket.state) { case State_Rocket.counting: rocket.lunchDevice.countdown_Prepare.temper -= Time.deltaTime; if ((rocket.lunchDevice.countdown_Prepare.timer - rocket.lunchDevice.countdown_Prepare.temper) > 1.0f) { Debug.Log("倒数" + (int)rocket.lunchDevice.countdown_Prepare.timer); rocket.lunchDevice.countdown_Prepare.timer = rocket.lunchDevice.countdown_Prepare.temper; } if (rocket.lunchDevice.countdown_Prepare.temper < 0.0f) { Debug.Log("发射"); rocket.state = State_Rocket.lunching; } break; case State_Rocket.lunching: rocket.lunchDevice.countdown_lunch.temper -= Time.deltaTime; if (rocket.lunchDevice.countdown_lunch.timer - rocket.lunchDevice.countdown_lunch.temper > 1.0f) { Debug.Log("火箭离地" + (3 - (int)rocket.lunchDevice.countdown_lunch.timer) + "秒"); rocket.lunchDevice.countdown_lunch.timer = rocket.lunchDevice.countdown_lunch.temper; } if (rocket.lunchDevice.countdown_lunch.temper < 0.0f) { Debug.Log("火箭成功起飞"); rocket.state = State_Rocket.flying; } break; case State_Rocket.flying: rocket.image.rectTransform.position += new Vector3(0.0f, Time.deltaTime * rocket.speed, 0.0f); break; } }
private async Task OnUpdate(CancellationToken token) { if (Game.IsPaused || !this.Owner.IsAlive || !this.Rocket.CanBeCasted || !this.RocketPush.Value || this.Config.General.ComboKey.Value.Active) { await Task.Delay(250, token); return; } var creeps = EntityManager <Unit> .Entities.OrderBy(x => x.Distance2D(this.Owner)).Where( x => x.IsValid && x is Creep && x.IsSpawned && !x.IsNeutral && x.Health + 50 <= GetDamage(x) && !x.IsMoving && x.IsAlive && x.Team != this.Owner.Team && x.Distance2D(this.Owner) > 1000).ToList(); if (creeps.Any()) { var input = new PredictionInput(Owner, creeps.Last(), this.Rocket.GetCastDelay() / 1000f, 1750, float.MaxValue, 600, PredictionSkillshotType.SkillshotCircle, true, creeps) { Delay = Math.Max(Rocket.CastPoint + Game.Ping, 0) / 1000f }; var output = this.Rocket.GetPredictionOutput(input); if (output.HitChance >= HitChance.Medium) { Rocket.UseAbility(output.CastPosition); await Task.Delay(Rocket.GetCastDelay(), token); } } }
public void launchMission(MissionData mission) { Debug.Log("launchMission: " + mission); setUiModeMissionControl(); FlightPlan flightPlan = registry.flightPlans.Where(plan => plan.destination == mission.destinationData).First(); Rocket rocket = GameObject.Instantiate(mission.rocketData.rocketObject); rocket.setSprite(mission.rocketData.icon); var activeMission = new ActiveMission(this, rocket, mission, Time.time, flightPlan); gameState.registerActiveMission(activeMission); gameState.funds -= mission.getCost(); gameState.registerProgress(mission.destinationData.progressionValue); activeMission.launch(); if (missionWillFail(mission)) { float explodeAfter = mission.getDurationSeconds() * 0.1f * Convert.ToSingle(random.NextDouble()); StartCoroutine(failMission(activeMission, explodeAfter)); } }
public override void Process(RocketStageUpdate packet) { GameObject gameObjectConstructor = NitroxEntity.RequireObjectFrom(packet.ConstructorId); GameObject gameObjectRocket = NitroxEntity.RequireObjectFrom(packet.Id); Rocket rocket = gameObjectRocket.RequireComponent <Rocket>(); rocket.StartRocketConstruction(); ItemGoalTracker.OnConstruct(packet.CurrentStageTech); RocketConstructor rocketConstructor = gameObjectConstructor.GetComponentInChildren <RocketConstructor>(true); if (rocketConstructor) { GameObject gameObjectTobuild = SerializationHelper.GetGameObject(packet.SerializedGameObject); rocketConstructor.ReflectionCall("SendBuildBots", false, false, gameObjectTobuild); } else { Log.Error($"{nameof(RocketStageUpdateProcessor)}: Can't find attached rocketconstructor with id {packet.ConstructorId} for rocket with id {packet.Id}"); } }
void OnTriggerEnter(Collider other) { if (other.tag.CompareTo("PlayerRocket") == 0) //如果被子弹撞到 { Rocket rocket = other.GetComponent <Rocket>(); if (rocket != null) { Instantiate(m_explosionFX, m_transform.position, Quaternion.identity); m_life = m_life - rocket.m_power; //生命减少 if (m_life <= 0) { GameManager.Instance.AddScore(m_point); //更新UI上的分数 Instantiate(m_explosionFX, m_transform.position, Quaternion.identity); //爆炸特效 Destroy(this.gameObject); //自我销毁 } } } else if (other.tag.CompareTo("Player") == 0) //如果主角被子弹撞到 { m_life = 0; Destroy(this.gameObject); //自我销毁 } }
public override void Initialize() { bg = new Ground(this.game, this.screenWidth, this.screenHeight, this.sceneNum); for (int i = 0; i < NUM_OF_PLAYERS; i++) { players[i] = new Player(game, i); players[i].Position = new Vector2(); players[i].Position.X = this.screenWidth / (NUM_OF_PLAYERS + 1) * (i + 1); int[] terrainContour = bg.getTerrainContour(); players[i].Position.Y = bg.terrainContour[(int)players[i].Position.X]; } //for (int i = 0; i < NUM_OF_PLAYERS; i++) //{ //} bg.setupGround(players); //bg.FlattenTerrainBelowPlayers(players); _rocket = new Rocket(game, this.screenWidth, this.screenHeight); _explosion = new Explosion(game); flock = new Flock(game, this.screenWidth, this.screenHeight, this.sceneNum); //generateFlock(); //bird = new Bird(this.game, this.screenWidth, this.screenHeight); //goal1Rect = new Rectangle(125, Consts.GoalYline, 200, 1); //goal2Rect = new Rectangle(125, screenHeight - Consts.GoalYline - 5, 200, 1); //State = 0; //P1Score = 0; //P2Score = 0; //endScene = false; //ballSprite.InitBallParam(); }
protected override void Given() { const int areaDimensionX = 100; const int areaDimensionY = 100; const int platformDimensionX = 50; const int platformDimensionY = 50; _positionX = 20; _positionY = 40; var approachCheckResultMapper = new ApproachCheckResultMapper(); var strategy = new ZartisExerciseStrategy(); var platformDimension = new Dimension(platformDimensionX, platformDimensionY); var platform = new LandingPlatform(platformDimension, strategy); var areaDimension = new Dimension(areaDimensionX, areaDimensionY); var area = new LandingArea(areaDimension, platform, approachCheckResultMapper); var rocket = new Rocket(area); rocket.CheckApproach(_positionX, _positionY); _sut = new Rocket(area); _expectedResult = "clash"; }
//回调 - 碰撞函数 private void OnTriggerEnter(Collider other) { Rocket rocket = other.GetComponent <Rocket>();//获取子弹C#脚本组件 //碰撞子弹 if (other.tag.CompareTo("PlayerRocket") == 0) { m_life -= rocket.m_power; if (m_life <= 0) { //敌机死亡得分 GameManager.Instance.AddScore(m_point); //使用GameManager中的方法 Instantiate(m_explosionFX, m_transform.position, Quaternion.identity); //爆炸音效 Destroy(this.gameObject); } } //碰撞玩家 else if (other.tag.CompareTo("Player") == 0) { m_life = 0; Instantiate(m_explosionFX, m_transform.position, Quaternion.identity);//爆炸音效 Destroy(this.gameObject); } }
protected override async Task KillStealAsync(CancellationToken token) { if (Game.IsPaused || !this.Owner.IsAlive || !this.Rocket.CanBeCasted) { await Task.Delay(125, token); return; } var killstealTarget = EntityManager <Hero> .Entities.FirstOrDefault( x => x.IsAlive && x.Team != this.Owner.Team && this.Rocket.CanBeCasted && this.Rocket.CanHit(x) && x.Distance2D(this.Owner) < 5000 && !x.IsIllusion && x.Health < GetDamage(x)); if (killstealTarget != null) { var input = new PredictionInput(Owner, killstealTarget, this.Rocket.GetCastDelay() / 1000f, 1750, float.MaxValue, 600, PredictionSkillshotType.SkillshotCircle, true, null) { Delay = Math.Max(Rocket.CastPoint + Game.Ping, 0) / 1000f }; var output = this.Rocket.GetPredictionOutput(input); if (output.HitChance >= HitChance.Medium) { Rocket.UseAbility(output.CastPosition); await this.AwaitKillstealDelay(Rocket.GetCastDelay(), token); } } }
private void FireRocket() { firedrocket = RI.GetStuffFromPool <Rigidbody>(RI.rocket_pools[explosion_index].pooled_rockets); firedrocket.transform.position = RocketSpawn.position; firedrocket.transform.rotation = Quaternion.Euler(new Vector3(0, 0, -90f)); firedrocket.gameObject.SetActive(true); rocket = firedrocket.GetComponent <Rocket>(); rocket.SetExplosion -= RI.InitiateExplosion; rocket.SetExplosion += RI.InitiateExplosion; rocket.explosion_indx = explosion_index; if (ifenemyfire()) { firedrocket.tag = "EnemyRocket"; rocket_direction = player_target.transform.position - RocketSpawn.position; } else { poss = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 162f - 148.1f)); rocket_direction = poss - RocketSpawn.position; } firedrocket.velocity = rocket_direction.normalized * (rocket.acceleration + 5f); }
void OnTriggerEnter(Collider other) { if (other.tag.CompareTo("PlayerRocket") == 0) { Rocket rocket = other.GetComponent <Rocket>(); if (rocket != null) { m_life -= rocket.m_power; GameManager.Instance.AddScore(m_point); beHit(); } } else if (other.tag.CompareTo("Player") == 0) { beHit(); } if (other.tag == "bound") { m_life = 0; GameManager.Instance.AddScore(-10); Destroy(this.gameObject); } }
//-------------------------------------------------------------------------------- // OBJECT POOL //-------------------------------------------------------------------------------- public Rocket Alloc(Vector2 position, Vector2 heading) { Assert(IsPrefab); Rocket result; if (next != null) { // RECYCLE INSTANCE result = next; next = result.next; result.next = null; result.xform.position = position; result.gameObject.SetActive(true); } else { // CREATE NEW INSTANCE result = Dup(this, position); result.prefab = this; } // RE-INIT INSTANCE result.Init(heading.normalized); return(result); }
private void explosion(GameObject caller) { foreach (GameObject sploded in inExplody) { if (!sploded.name.Equals(gameObject.name) && !sploded.name.Equals(capsule.name)) { if (sploded.tag == PLAYER_TAG) { doDamage(sploded.name, 100); } explosionForces(sploded); } else if (sploded != gameObject) { Rocket r = sploded.GetComponent <Rocket>(); if (r != null && !sploded.Equals(caller)) { r.explosion(gameObject); } } } Destroy(gameObject); }
void Awake() { this.rocketFactory = FindObjectOfType <Rocket>(); undo1 = true; undo2 = true; undo3 = true; EventManager.Subscribe("Workshop", this.OnWorkShop); EventManager.Subscribe("Close WorkShop", this.CloseWorkShop); EventManager.Subscribe("Build Rocket", this.rocketFactory.BuildRocket); EventManager.Subscribe("Thrusters", this.OnThrusters); EventManager.Subscribe("Player chose TC1", this.rocketFactory.CreateThrusters1); EventManager.Subscribe("Player chose TC2", this.rocketFactory.CreateThrusters2); EventManager.Subscribe("Player chose TC3", this.rocketFactory.CreateThrusters3); EventManager.Subscribe("Cockpit", this.OnCockpit); EventManager.Subscribe("Player chose CP1", this.rocketFactory.CreateCockpit1); EventManager.Subscribe("Player chose CP2", this.rocketFactory.CreateCockpit2); EventManager.Subscribe("Player chose CP3", this.rocketFactory.CreateCockpit3); EventManager.Subscribe("Apply Wings", this.OnWings); EventManager.Subscribe("Player chose WC1", this.rocketFactory.CreateWings1); EventManager.Subscribe("Player chose WC2", this.rocketFactory.CreateWings2); EventManager.Subscribe("Player chose WC3", this.rocketFactory.CreateWings3); }
private void insertStages(int rocketID) { using (SqlConnection connection = new SqlConnection(connectionString)) { StringBuilder insertStages = new StringBuilder(); Rocket rocket = Conversions.ConvertTableToRocket(RocketTable, getTextBoxText); foreach (Stage stage in rocket.StageList) { insertStages.Append("EXECUTE spAddStage " + rocketID.ToString() + "," + (stage.ID + 1).ToString() + ", " + stage.WetMass.ToString() + ", " + stage.DryMass.ToString() + ", " + stage.Isp.ToString() + ", " + stage.DeltaV.ToString() + ", " + stage.Thrust.ToString() + ", " + stage.MinTWR.ToString() + ", " + stage.MaxTWR.ToString() + ";"); } SqlCommand insertStagesCommand = new SqlCommand(insertStages.ToString(), connection); connection.Open(); insertStagesCommand.ExecuteNonQuery(); } }
public override void ActionsDuringFadeOut() { Rocket r = rocket.GetComponent <Rocket>(); Guy g = FindObjectOfType <Guy>(); if (CorrectAnswer()) { AudioSource.PlayClipAtPoint(clipOk, Camera.main.transform.position); g.FinishedMinigame(); r.isRestored = true; rocket.GetComponent <SpriteRenderer>().sprite = rocketFull; } else { blockingLayer.GetComponent <Image>().color = blockingLayerColor; AudioSource.PlayClipAtPoint(audioClip, Camera.main.transform.position); g.ResetState(); } g.transform.position = new Vector3(-0.557f, -5.76f, g.transform.position.z); r.DisableFires(); blockingLayer.SetActive(false); }
public void Init(TestObject module, int id) { ID = id; m_module = module; m_module.Button = this; if (m_gaugeFill != null) { if (module is Rocket rocket) { m_gaugeFill.gameObject.SetActive(rocket.m_hasFuel); m_gaugeOver.gameObject.SetActive(rocket.m_hasFuel); m_rocket = rocket; } } if (module is Magnet magnet) { m_magnet = magnet; m_magnetLocked.SetActive(true); m_on.SetActive(false); m_off.SetActive(false); } GetComponent <Button>().onClick.AddListener(OnClick); if (m_module.IsActive) { m_on.SetActive(true); m_off.SetActive(false); } else { m_on.SetActive(false); m_off.SetActive(true); } }
private void Update() { if (_currentRocket) { transform.LookAt(_currentRocket.transform); } if (Input.GetMouseButtonDown(0)) { Ray ray = _camera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { // If there is already a rocket flying, refocus on the new one and stop listening to this one if (_currentRocket) { _currentRocket.OnDone -= onRocketDone; } // Create new fireworks and also keep track of it as the last one added _currentRocket = Instantiate(_prefabFirework, hit.point, Quaternion.identity).GetComponent <Rocket>(); _currentRocket.OnDone += onRocketDone; } } }
private Tile LoadRocketTile(int x, int y, bool moveToLeft) { GameObjectList enemies = this.Find("enemies") as GameObjectList; TileField tiles = this.Find("tiles") as TileField; Vector2 startPosition = new Vector2(((float)x + 0.5f) * tiles.CellWidth, (y + 1) * tiles.CellHeight); Rocket enemy = new Rocket(moveToLeft, startPosition); enemies.Add(enemy); return new Tile(); }
private void Awake() { viewer = FindObjectOfType <Camera>(); rocket = _bulletPrefab.GetComponent <Rocket>(); player = GetComponent <Player>(); }
private void Start() { instance = this; }
public override void AffectBoosterShip(GameObject boosterShip) { Rocket boosterScript = boosterShip.GetComponent <Rocket>(); boosterScript.ExecuteParalysis(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); device = graphics.GraphicsDevice; backgroundTexture = Content.Load<Texture2D>("gamebg"); screenWidth = device.PresentationParameters.BackBufferWidth; screenHeight = device.PresentationParameters.BackBufferHeight; foregroundTexture = Content.Load<Texture2D>("foreground"); SetUpPlayers(); armyTexture = Content.Load<Texture2D>("army2"); Grenade gre = new Grenade(); GrenadeBuilder grenade = new GrenadeBuilder(gre); grenade.build(); Rocket roc = new Rocket(); RocketBuilder rocket = new RocketBuilder(roc); rocket.build(); playerScaling = 40.0f / (float)armyTexture.Width; }
static void Main() { //getting the bricks into the array; for (int i = 0; i < bricks.GetLength(0); i++) { for (int j = 0; j < bricks.GetLength(1); j++) { bricks[i, j] = '#'; } } // getting the paddle for (int i = 0; i < paddleLenght; i++) { paddle[i] = '='; } RemoveScrolls(); Console.BackgroundColor = ConsoleColor.DarkBlue; while (runGame) { // moving the paddle keys if (Console.KeyAvailable) { ConsoleKeyInfo keyInfo = Console.ReadKey(); if ((keyInfo.Key == ConsoleKey.LeftArrow) && (paddlePosition > 1)) { paddlePosition -= 2; } if ((keyInfo.Key == ConsoleKey.RightArrow) && (paddlePosition <= rightBorder - paddleLenght - 1)) { paddlePosition += 2; } if ((keyInfo.Key == ConsoleKey.Spacebar) && (!nuclearLaunchDetected)) { // launch the rocket ; ) myxaxa // creating a new missle missle = new Rocket(bottomBorder, paddlePosition, paddlePosition + paddleLenght -1 ); // when it is launched nuclearLaunchDetected = true; } } Thread.Sleep(timer); Console.Clear(); BrickColusion(); // checks the brick is hitten DrawBricks(); // draw the ramain bricks MoveBall(); // draw the ball DrawPaddle(); // draw the paddle Score(); // display the current score HitGround(); // when hit the spacebar launch a missles from the paddle if ((nuclearLaunchDetected) && (missle.hPosition > 0)) { missle.Launch(); } else { nuclearLaunchDetected = false; } Console.SetCursorPosition(positionX, positionY); Console.ForegroundColor = ConsoleColor.Red; Console.Write("*"); } }
public KinectRocketGestures(Skeleton skeleton, Rocket rocket) { _skeleton = skeleton; _rocket = rocket; }
protected override void OnRocketCollide(Rocket rocket) { float damage = rocket.Damage(); audio.PlayOneShot(mSoundBoom); if (mPlayerSide == PlayerSide.PLAYER_LEFT || mPlayerSide == PlayerSide.PLAYER_RIGHT) { mHealth -= damage; for (int i=4; i>=(int)mHealth/20 && mHealth > 0 && mPlayerSide != PlayerSide.PLANET_AI; i--) { moons[i].SetActive(false); } } if (mHealth <= 0f) { Body.gameOver = true; GameOver go = Instantiate(pfGameOverScreen) as GameOver; // Flag the winner PlayerSide winner = ((mPlayerSide == PlayerSide.PLAYER_LEFT) ? PlayerSide.PLAYER_RIGHT : PlayerSide.PLAYER_LEFT); go.SetWinner(winner); } if (mPlayerSide == PlayerSide.PLANET_AI) { Planet target = PlayerPlanets[FindClosestPlayer()]; transform.LookAt(target.transform.position); mAim.FireRocket(100f, transform.position); } }
private void InitRocket() { _rocket = new Rocket(@"vid_0a81", @"pid_ff01"); _rocket.Connect(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { Rocket = new Rocket(@"vid_0a81", @"pid_ff01"); Rocket.Connect(); }
private void CheckBoxMoveMode_OnValueChanged(object sender, RoutedEventArgs e) { if (CheckBoxMoveMode.IsChecked == true ) { Rocket = new Rocket(@"vid_0a81", @"pid_ff01", Rocket.MoveMode.Continuous); Rocket.Connect(); } else { Rocket = new Rocket(@"vid_0a81", @"pid_ff01", Rocket.MoveMode.StepbyStep); Rocket.Connect(); } }
public IActionResult CreateRocket([FromBody] Rocket rocket) { return(Ok(rocket)); }
void Start() { rocket = GameObject.FindObjectOfType <Rocket>(); StartCoroutine(Spawnmeteor()); StartCoroutine(SpawanRedBomb()); }
/* Callback for registering whenever a rocket * hits the body. By default, nothing happens. */ protected virtual void OnRocketCollide(Rocket rocket) { // Dooby dooby doo }