void Start() { objetoSomSub = new GameObject(); objetoSomSub.AddComponent(typeof(AudioSource)); objetoSomSub.GetComponent <AudioSource> ().loop = true; objetoSomSub.transform.localPosition = new Vector3(0, 0, 0); objetoSomSub.GetComponent <AudioSource> ().clip = somSubmerso; objetoSomSub.transform.parent = transform; objetoSomSub.SetActive(false); // _fisheye = GetComponent <Fisheye> (); _blur = GetComponent <Blur> (); _edge = GetComponent <EdgeDetection> (); _vortex = GetComponent <Vortex> (); // GetComponent <SphereCollider> ().radius = 0.005f; GetComponent <SphereCollider> ().isTrigger = false; GetComponent <Rigidbody> ().isKinematic = true; GetComponent <Camera> ().nearClipPlane = 0.01f; // _blur.iterations = 5 - DistanciaDeVisib; _blur.blurSpread = 1 - (Visibilidade / 10); // _vortex.radius = new Vector2(1, 1); _vortex.center = new Vector2(0.5f, 0.5f); // _edge.mode = EdgeDetection.EdgeDetectMode.TriangleLuminance; _edge.lumThreshold = 0; _edge.sampleDist = 0; _edge.edgesOnly = intensidadeCor; _edge.edgesOnlyBgColor = corAgua; // _blur.enabled = false; _fisheye.enabled = false; _edge.enabled = false; _vortex.enabled = false; // planoGotas = GameObject.CreatePrimitive(PrimitiveType.Plane); Destroy(planoGotas.GetComponent <MeshCollider> ()); planoGotas.transform.localScale = new Vector3(0.02f, 0.02f, 0.02f); planoGotas.transform.parent = transform; planoGotas.transform.localPosition = new Vector3(0, 0, 0.05f); planoGotas.transform.localEulerAngles = new Vector3(90, 180, 0); planoGotas.GetComponent <Renderer>().material.shader = Shader.Find("FX/Glass/Stained BumpDistort"); planoGotas.GetComponent <Renderer> ().material.SetTexture("_BumpMap", TexturaPingos); planoGotas.GetComponent <Renderer> ().material.SetFloat("_BumpAmt", 0); // if (GetComponent <SunShafts> () != null) { temSunShafts = true; _sunShafts = GetComponent <SunShafts> (); intSolInicial = _sunShafts.sunShaftIntensity; } else { temSunShafts = false; } // _audSourc = GetComponent <AudioSource> (); }
public override void LoadContent() { Background tempBack = new Background(TheGame.Content.Load <Texture2D>(@"Maps/Level1/space"), TheSpriteBatch); player = new Player(TheGame, TheSpriteBatch, new Vector2(700, 300)); player.LoadContent(); //Loading the Enemy Sprites enemy = new Vortex(TheGame, TheSpriteBatch, new Vector2(200, 200)); enemy.LoadContent(); spawnManager = new SpawnManager(TheGame, TheSpriteBatch); //Object Manager objectManager.RegisterObject(tempBack); objectManager.RegisterObject(enemy); objectManager.RegisterObject(player); collisionManager.RegisterObject(player); collisionManager.RegisterObject(enemy); levelLoaded = true; }
// Initial stuff. void Start() { sr = GetComponent <SpriteRenderer> (); dialogue = dialogueObject.GetComponent <Subtitle> (); player = GameObject.Find("Player"); playerScript = player.GetComponent <Player> (); vortex = GameObject.Find("Vortex").gameObject; vortexScript = vortex.GetComponent <Vortex> (); characterRGB = sr.color; lifeColor = sr.color; lifeForce = ((lifeColor.r + lifeColor.g + lifeColor.b) / (characterRGB.r + characterRGB.g + characterRGB.b)); lifeForce = Mathf.Sqrt(lifeForce); currentFlare = (flare * lifeForce); currentFlareR = (flareR * lifeForce); currentFlareG = (flareG * lifeForce); currentFlareB = (flareB * lifeForce); sr.color = new Color(lifeColor.r + (currentFlareR), lifeColor.g + +(currentFlareG), lifeColor.b + +(currentFlareB)); lt = transform.Find("Glow").GetComponent <Light> (); lt.color = lifeColor; lt.intensity = ((lifeColor.r + lifeColor.g + lifeColor.b) * currentFlare) - 1.174f; }
public override void AddRecipes() { Nebula.AddRecipes(this); Solar.AddRecipes(this); Stardust.AddRecipes(this); Vortex.AddRecipes(this); }
public override void LoadContent() { Background tempBack = new Background(TheGame.Content.Load<Texture2D>(@"Maps/Level2/underwaterlvl"), TheSpriteBatch); player = new Player(TheGame, TheSpriteBatch, new Vector2(100, 500)); player.LoadContent(); //Loading the Enemy Sprites enemy = new Vortex(TheGame, TheSpriteBatch, new Vector2(200, 200)); enemy.LoadContent(); spawnManager = new SpawnManager(TheGame, TheSpriteBatch); //Object Manager objectManager.RegisterObject(tempBack); objectManager.RegisterObject(enemy); objectManager.RegisterObject(player); collisionManager.RegisterObject(player); collisionManager.RegisterObject(enemy); levelLoaded = true; }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); // Onderstaande 4 textures worden gebruikt voor collision bepalingen. _tileTexture = Content.Load <Texture2D>("Tiles/L2/BlockA1"); _playerTexture = Content.Load <Texture2D>("Tiles/L2/BlockA1"); _enemyTexture = Content.Load <Texture2D>("Tiles/L2/BlockA1"); _bossTexture = Content.Load <Texture2D>("Tiles/L2/BlockA1"); _player = new Player(_playerTexture, new Vector2(50, 50), _spriteBatch); _vortex = new Vortex(null, new Vector2(0, 0), _spriteBatch); _demonHorde = new List <Enemy>(); _geryon = new Boss(_bossTexture, new Vector2(250, 250), _spriteBatch, _mobDistance, GeryonHealth); _geryon.Load(Content); _healthTexture = Content.Load <Texture2D>("18"); _player.Load(Content); _vortex.Load(Content); _board = new Board(_spriteBatch, _tileTexture, 59, 25); _board.CreateNewRandomBoard(); // Hier worden de ingestelde hoeveelheid (gc.MaxScoreCount) Coins in de speelwereld op een willekeurige plaats gezet, met controle dat deze niet // per ongeluk worden ingebouwd door random geplaatste blocked tiles. _coins = new List <Coin>(); for (int i = 0; i < gc.MaxScoreCount; i++) { Vector2 randPos = new Vector2((_rand.Next(0, Konquer.ScreenWidth / TileWidth) * TileWidth) + 24, _rand.Next(0, Konquer.ScreenHeight / TileHeight) * TileHeight); Rectangle coinRect = new Rectangle((int)randPos.X, (int)randPos.Y - TileHeight, TileWidth, TileHeight); if (!_board.HasRoomForRectangle(coinRect)) { randPos = new Vector2(_rand.Next(TileWidth, (ScreenWidth - (TileWidth * 2))), _rand.Next(0, Konquer.ScreenHeight / TileHeight) * TileHeight); coinRect = new Rectangle((int)randPos.X, (int)randPos.Y, TileWidth, TileHeight); } _coins.Add(new Coin(null, randPos, _spriteBatch)); _coins[i].Load(Content); } //Animated background List <Texture2D> _BG = new List <Texture2D>(); for (int i = 0; i < 8; i++) { _BG.Add(Content.Load <Texture2D>("BG/BG" + i)); } background1 = new Background(); background1.SetBG(_BG); //Font _myFont = Content.Load <SpriteFont>("DebugFont"); //Pause menu _pauseMenuTexture = new Texture2D(GraphicsDevice, 1, 1); _pauseMenuTexture.SetData(new[] { Color.DarkSlateBlue }); TriggerPauseGame(); }
public override void UnLoadContent() { levelLoaded = false; player = null; enemy = null; spawnManager = null; base.UnLoadContent(); }
// Use this for initialization void Start() { vortex = Camera.main.GetComponent <Vortex>(); vortex.enabled = true; vortex.radius = radius; vortex.angle = angle; vortex.center = center; }
void Awake() { vortexScript = GetComponent <Vortex>(); vortexScript.radius = Vector2.one; vortexScript.center = new Vector2(0.5f, 0.5f); vortexScript.angle = 0; isPlaying = false; }
private void checkForGameOver(Vortex myVortex) { if (darwin.isOnTop(myVortex)) { gameOver = true; fellDownPit = true; } }
private void load() { Add(new Box { Colour = Color4Extensions.FromHSV(345, 0.2f, 0.1f), RelativeSizeAxes = Axes.Both }); vortex = new Vortex { Speed = 5, Position = new Vector2(0.1f, 0), Scale = new Vector2(20) }; var emitter = new ParticleEmitter { RelativeSizeAxes = Axes.Both, Vortices = new List <Vortex> { vortex } }; Add(emitter); Add(circle = new Circle { Position = emitter.Vortices[0].Position, Size = emitter.Vortices[0].Scale, Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0.25f }); AddSliderStep("Position X", -100f, 100f, 1f, p => { vortex.Position.X = p; }); AddSliderStep("Position Y", -100f, 100f, 1f, p => { vortex.Position.Y = p; }); AddSliderStep("Speed", -10, 10, 1f, p => { vortex.Speed = p; }); AddSliderStep("Scale", -10, 10, 1f, p => { vortex.Scale.X = p; }); AddSliderStep("Velocity X", -100f, 100f, 0f, p => { vortex.Velocity.X = p; }); AddSliderStep("Velocity Y", -100f, 100f, 0f, p => { vortex.Velocity.Y = p; }); Scheduler.AddDelayed(() => { emitter.Add(new Particle { Size = new Vector2(2), Velocity = new Vector2 { X = (RNG.NextSingle(0, 3f) - 1.5f) * 80, Y = -(RNG.NextSingle(0, 5) + (8 * 20)) } }); }, 5, true); }
private void Awake() { inputController = FindObjectOfType <InputController>(); vortex = GetComponentInChildren <Vortex>(); inputController.StartClick += StartVortex; inputController.MoveClick += MoveVortex; inputController.StopClick += StopVortex; Events.Level.Start += SetActive; Events.Level.Finish += SetInactive; }
// Use this for initialization void Start() { v = GetComponent <Vortex>(); v.enabled = false; mb = GetComponent <MotionBlur>(); mb.enabled = false; ss = GetComponent <SunShafts>(); p = GameObject.FindGameObjectWithTag("Player").GetComponent <Character>(); }
void Awake() { ScreenManager.OnNewGame += ScreenManager_OnNewGame; ScreenManager.OnStartGame += ScreenManager_OnStartGame; ScreenManager.OnExitGame += ScreenManager_OnExitGame; mVortex = FindObjectOfType <Vortex>(); mPlayers = new Player[MaxNumberOfPlayers]; mScores = new int[MaxNumberOfPlayers]; Debug.Assert(Deposits.Length >= MaxNumberOfPlayers, "Not enough deposits for the maximum amount of players."); Debug.Assert(PlayerColors.Length >= MaxNumberOfPlayers, "Not enough player colors for the maximum amount of players."); }
public VortexData AddVortex(Vector2 radius, Vector2 center, float slow, bool enabled = true) { VortexData temp = new VortexData(); Vortex v = gameObject.AddComponent <Vortex>(); v.shader = vortexShader; v.enabled = enabled; v.radius = radius; v.center = center; temp.vortex = v; temp.slow = slow; _vortices.Add(temp); return(temp); }
// -------------------------------------<<<- <<<- <<<- FUNCTIONEZ EL LOCOS void Start() { randomRange1 = Random.Range(-5, 5); randomRange2 = Random.Range(0, 0.2f); randomRange3 = Random.Range(-0.4f, 0.4f); randomRange4 = Random.Range(-5, 5); randomRange5 = Random.Range(-0.4f, 0.4f); randomRange6 = Random.Range(-0.1f, 0.1f); vortexEffect = GetComponent <Vortex>(); fisheyeEffect = GetComponent <Fisheye>(); dof = GetComponent <DepthOfField>(); dofFocalLenght = dof.focalLength; dofFocalSize = dof.focalSize; dofAperture = dof.aperture; bloom = GetComponent <Bloom>(); bloom.bloomIntensity = 0.09f;; bloom.bloomThreshold = -0.06f;; }
void Start() { camera = Camera.main; player = PlayerController.Instance; Camera.main.orthographicSize = 4f * Screen.height / Screen.width * 0.5f; spawner = ObjectSpawner.Instance; positions.Add(player.transform.position); positions.Add(spawner.transform.position); vortex = GetComponent <Vortex>(); twirl = GetComponents <Twirl>(); ToggleTwirl(false); shapeModule = menuParticleSystem.shape; menuParticleSystem.transform.position = camera.ViewportToWorldPoint(new Vector2(.5f, 0f)) + Vector3.forward; if (Screen.width > Screen.height) { camera.rect = new Rect(.25f, 0.0f, .5f, 1.0f); backgroundCamera.transform.gameObject.SetActive(true); } else { camera.rect = new Rect(0f, 0.0f, 1f, 1.0f); backgroundCamera.transform.gameObject.SetActive(false); } // backgroundCamera.transform.position = transform.position - Vector3.up * 3f; }
public override async Task ExecuteAsync(CancellationToken token) { var target = this.TargetSelector.Active.GetTargets() .FirstOrDefault(x => !x.IsInvulnerable() && !UnitExtensions.IsMagicImmune(x) && x.IsAlive); var silenced = UnitExtensions.IsSilenced(this.Owner); var sliderValue = this.Config.UseBlinkPrediction.Item.GetValue <Slider>().Value; if (this.BlinkDagger != null && this.BlinkDagger.Item.IsValid && target != null && Owner.Distance2D(target) <= 1200 + sliderValue && !(Owner.Distance2D(target) <= 400) && this.BlinkDagger.Item.CanBeCasted(target) && this.Config.ItemToggler.Value.IsEnabled(this.BlinkDagger.Item.Name)) { var l = (this.Owner.Distance2D(target) - sliderValue) / sliderValue; var posA = this.Owner.Position; var posB = target.Position; var x = (posA.X + (l * posB.X)) / (1 + l); var y = (posA.Y + (l * posB.Y)) / (1 + l); var position = new Vector3((int)x, (int)y, posA.Z); Log.Debug("Using BlinkDagger"); this.BlinkDagger.UseAbility(position); await Await.Delay(this.GetItemDelay(target), token); } //Are we in an ult phase? var inUltimate = UnitExtensions.HasModifier(Owner, "modifier_storm_spirit_ball_lightning") || Lightning.IsInAbilityPhase; //Check if we're silenced, our target is alive, and we have a target. var UltDistance = Config.DistanceForUlt.Item.GetValue <Slider>().Value; //Check for distance to target and push against slider value if (target != null && target.IsAlive && Owner.Distance2D(target) >= 400 && Owner.Distance2D(target) <= UltDistance && Config.AbilityToggler.Value.IsEnabled(Lightning.Name) && !silenced) { //Based on whether they are moving or not, predict where they will be. if (target.IsMoving) { var PredictedPosition = Ensage.Common.Extensions.UnitExtensions.InFront(target, 0); //Check the mana consumed from our prediction. double TempManaConsumed = (Lightning.GetAbilityData("ball_lightning_initial_mana_base") + ((Lightning.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * Owner.MaximumMana)) + ((Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, PredictedPosition) / 100) * (((Lightning.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * Owner.MaximumMana))); if (TempManaConsumed <= Owner.Mana && !inUltimate) { Lightning.UseAbility(PredictedPosition); await Await.Delay( (int)(Lightning.FindCastPoint() + Owner.GetTurnTime(PredictedPosition) * 2250 + Game.Ping), token); } } else { var PredictedPosition = target.NetworkPosition; double TempManaConsumed = (Lightning.GetAbilityData("ball_lightning_initial_mana_base") + ((Lightning.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * Owner.MaximumMana)) + ((Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, PredictedPosition) / 100) * (((Lightning.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * Owner.MaximumMana))); if (TempManaConsumed <= Owner.Mana && !inUltimate) { Lightning.UseAbility(PredictedPosition); await Await.Delay( (int)(Lightning.FindCastPoint() + Owner.GetTurnTime(PredictedPosition) * 2250 + Game.Ping), token); } } } //Vars we need before combo. bool HasAghanims = Owner.HasItem(ItemId.item_ultimate_scepter); float VortexCost = Vortex.GetManaCost(Vortex.Level - 1); float RemnantCost = Remnant.GetManaCost(Remnant.Level - 1); float CurrentMana = Owner.Mana; float TotalMana = Owner.MaximumMana; //This is here to stop us from ulting after our target dies. float RemnantAutoDamage = this.Remnant.GetAbilityData("static_remnant_damage"); if (this.Overload != null) { RemnantAutoDamage += this.Overload.GetDamage(Overload.Level - 1); } var RemnantAutokillableTar = ObjectManager.GetEntitiesFast <Hero>() .FirstOrDefault( x => x.IsAlive && x.Team != this.Owner.Team && !x.IsIllusion && this.Remnant.CanBeCasted() && this.Remnant.CanHit(x) && x.Health < (RemnantAutoDamage * (1 - x.MagicDamageResist)) && !UnitExtensions.IsMagicImmune(x) && x.Distance2D(this.Owner) <= 235); var ActiveRemnant = Remnants.Any(unit => unit.Distance2D(RemnantAutokillableTar) < 240); if (!silenced && target != null) { //there is a reason behind this; the default delay on storm ult is larger than a minimum distance travelled. var TargetPosition = target.NetworkPosition; /*TargetPosition *= 100; * TargetPosition = target.NetworkPosition + TargetPosition;*/ double ManaConsumed = (Lightning.GetAbilityData("ball_lightning_initial_mana_base") + ((Lightning.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * CurrentMana)) + ((Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, TargetPosition) / 100) * (((Lightning.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * CurrentMana))); //Always auto attack if we have an overload charge. if (UnitExtensions.HasModifier(Owner, "modifier_storm_spirit_overload") && target != null) { Owner.Attack(target); await Await.Delay(500); } //Vortex prioritization logic [do we have q/w enabled, do we have the mana to cast both, do they have lotus, do we have an overload modifier] if (!UnitExtensions.HasModifier(Owner, "modifier_storm_spirit_overload") && Config.AbilityToggler.Value.IsEnabled(Vortex.Name) && Vortex.CanBeCasted() && Config.AbilityToggler.Value.IsEnabled(Remnant.Name) && Remnant.CanBeCasted() && (VortexCost + RemnantCost) <= CurrentMana) { //Use Vortex if (!HasAghanims) { Vortex.UseAbility(target); await Await.Delay(GetAbilityDelay(Owner, Vortex), token); } //Use Vortex differently for aghanims. else { Vortex.UseAbility(); await Await.Delay(GetAbilityDelay(Owner, Vortex), token); } } //Remnant logic [w is not available, cant ult, close enough for the detonation] if (!UnitExtensions.HasModifier(Owner, "modifier_storm_spirit_overload") && target.IsAlive && Config.AbilityToggler.Value.IsEnabled(Remnant.Name) && Remnant.CanBeCasted() && !Vortex.CanBeCasted() && (CurrentMana <= RemnantCost + ManaConsumed || Owner.Distance2D(target) <= Remnant.GetAbilityData("static_remnant_radius"))) { Remnant.UseAbility(); await Await.Delay(GetAbilityDelay(Owner, Remnant), token); } //Ult logic [nothing else is available or we are not in range for a q] if (!UnitExtensions.HasModifier(Owner, "modifier_storm_spirit_overload") && target.IsAlive && Config.AbilityToggler.Value.IsEnabled(Lightning.Name) && Lightning.CanBeCasted() && (!Remnant.CanBeCasted() || Owner.Distance2D(target) >= Remnant.GetAbilityData("static_remnant_radius")) && (!Vortex.CanBeCasted(target) || Owner.Distance2D(target) <= UltDistance) //Don't cast ult if theres a remnant that can kill our target. && !inUltimate && (RemnantAutokillableTar == null || ActiveRemnant == false)) //todo: alternate check for aghanims { Lightning.UseAbility(TargetPosition); int delay = (int)((Lightning.FindCastPoint() + Owner.GetTurnTime(TargetPosition)) * 1250.0 + Game.Ping); Log.Debug($"{delay}ms to wait."); await Task.Delay(delay); } } if ((this.Nullifier != null && (this.Nullifier.Item.IsValid && target != null && this.Nullifier.Item.CanBeCasted(target) && this.Config.ItemToggler.Value.IsEnabled("item_nullifier")))) { Log.Debug("Using Nullifier"); this.Nullifier.UseAbility(target); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.BloodThorn != null && (this.BloodThorn.Item.IsValid && target != null && this.BloodThorn.Item.CanBeCasted(target) && this.Config.ItemToggler.Value.IsEnabled("item_bloodthorn")))) { Log.Debug("Using Bloodthorn"); this.BloodThorn.UseAbility(target); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.SheepStick != null && (this.SheepStick.Item.IsValid && target != null && this.SheepStick.Item.CanBeCasted(target) && this.Config.ItemToggler.Value.IsEnabled("item_sheepstick")))) { Log.Debug("Using Sheepstick"); this.SheepStick.UseAbility(target); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.Orchid != null) && this.Orchid.Item.IsValid && target != null && (this.Orchid.Item.CanBeCasted(target) && this.Config.ItemToggler.Value.IsEnabled("item_orchid"))) { Log.Debug("Using Orchid"); this.Orchid.UseAbility(target); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.RodofAtos != null && (this.RodofAtos.Item.IsValid && target != null && this.RodofAtos.Item.CanBeCasted(target) && this.Config.ItemToggler.Value.IsEnabled("item_rod_of_atos")))) { Log.Debug("Using RodofAtos"); this.RodofAtos.UseAbility(target); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.VeilofDiscord != null && (this.VeilofDiscord.Item.IsValid && target != null && this.VeilofDiscord.Item.CanBeCasted() && this.Config.ItemToggler.Value.IsEnabled("item_veil_of_discord")))) { Log.Debug("Using VeilofDiscord"); this.VeilofDiscord.UseAbility(target.Position); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.HurricanePike != null) && (double)(this.Owner.Health / this.Owner.MaximumHealth) * 100 <= (double)Config.HurricanePercentage.Item.GetValue <Slider>().Value&& this.HurricanePike.Item.IsValid && target != null && this.HurricanePike.Item.CanBeCasted() && this.Config.ItemToggler.Value.IsEnabled("item_hurricane_pike")) { Log.Debug("Using HurricanePike"); this.HurricanePike.UseAbility(target); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.ShivasGuard != null && (this.ShivasGuard.Item.IsValid && target != null && this.ShivasGuard.Item.CanBeCasted() && Owner.Distance2D(target) <= 900 && this.Config.ItemToggler.Value.IsEnabled("item_shivas_guard")))) { Log.Debug("Using Shiva's Guard"); this.ShivasGuard.UseAbility(); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if ((this.Mjollnir != null && (this.Mjollnir.Item.IsValid && target != null && this.Mjollnir.Item.CanBeCasted() && this.Config.ItemToggler.Value.IsEnabled("item_mjollnir")))) { Log.Debug("Using Mjollnir"); this.Mjollnir.UseAbility(Owner); await Await.Delay(this.GetItemDelay(target) + (int)Game.Ping, token); } if (this.Orbwalker.OrbwalkTo(target)) { return; } await Await.Delay(125, token); }
void Awake() { mVortex = FindObjectOfType <Vortex>(); mBody = GetComponent <Rigidbody>(); }
private void HandleVortexInput() { // upon pressing the left-click button if (Input.GetButtonDown("Fire1") && canSpawnVortex) { // enable the visual indicator vortexIndicator.enabled = true; // start building the vortex scale isBuildingVortex = true; } // while holding the left-click button if (Input.GetButton("Fire1") && canSpawnVortex && isBuildingVortex) { // build up the power of the vortex over time vortexScaleProgress = Mathf.Clamp(vortexScaleProgress + Time.deltaTime, 0, vortexBuildTime); // get the current mouse position in world coordinates Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); // set the indicator at the current mouse position vortexIndicator.transform.position = mousePos; // calculate the current radius based on the vortex scale float vortexScale = Mathf.Lerp(vortexMinScale, vortexMaxScale, vortexScaleProgress / vortexBuildTime) - 1; float radius = vortexBaseRadius + vortexRadiusGrowthRate * vortexScale; // scale the indicator based on the current radius vortexIndicator.transform.localScale = Vector2.one * radius * 2; // set the indicator color based on the current radius vortexIndicator.color = radius > vortexCrushRadiusThreshold ? vortexCrushIndicatorColor : vortexRegularIndicatorColor; } // upon releasing the left-click button if (Input.GetButtonUp("Fire1") && canSpawnVortex && isBuildingVortex) { // start the vortex spawn cooldown StartCoroutine(HandleVortexCooldown()); // stop building the vortex scale isBuildingVortex = false; // disable the visual indicator vortexIndicator.enabled = false; // get the current mouse position in world coordinates Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); // spawn a new vortex object at the mouse position Vortex vortex = Instantiate(vortexPrefab, mousePos, Quaternion.identity, spawnParent); // calculate the vortex stats based on the current vortex scale float vortexScale = Mathf.Lerp(vortexMinScale, vortexMaxScale, vortexScaleProgress / vortexBuildTime) - 1; float radius = vortexBaseRadius + vortexRadiusGrowthRate * vortexScale; float innerStrength = vortexBaseInnerStrength + vortexInnerStrengthGrowthRate * vortexScale; float outerStrength = vortexBaseOuterStrength + vortexOuterStrengthGrowthRate * vortexScale; // activate the vortex at the current vortex scale vortex.Activate(radius, innerStrength, outerStrength, vortexCrushForceThreshold, vortexCrushRadiusThreshold, vortexTargetLayers); // reset the scale progress vortexScaleProgress = 0; } // upon pressing the right-click button if (Input.GetButtonDown("Fire2") && isBuildingVortex) { // stop building the vortex scale isBuildingVortex = false; // disable the visual indicator vortexIndicator.enabled = false; // reset the scale progress vortexScaleProgress = 0; } }
private void setVortexes() { Vortex vn1 = new Vortex(board, 4, 4); Vortex vn2 = new Vortex(board, 5, 4); Vortex vn3 = new Vortex(board, 6, 4); Vortex vn4 = new Vortex(board, 7, 4); Vortex vn5 = new Vortex(board, 8, 4); Vortex vn6 = new Vortex(board, 9, 4); Vortex vn7 = new Vortex(board, 10, 4); Vortex vn8 = new Vortex(board, 11, 4); Vortex vn9 = new Vortex(board, 12, 4); Vortex vn10 = new Vortex(board, 13, 4); Vortex vn11 = new Vortex(board, 14, 4); Vortex vn12 = new Vortex(board, 15, 4); Vortex vn13 = new Vortex(board, 16, 4); Vortex vn14 = new Vortex(board, 17, 4); Vortex vn15 = new Vortex(board, 18, 4); Vortex vn16 = new Vortex(board, 19, 4); Vortex vn17 = new Vortex(board, 20, 4); Vortex vn18 = new Vortex(board, 21, 4); Vortex vn19 = new Vortex(board, 22, 4); Vortex vn20 = new Vortex(board, 23, 4); Vortex vn21 = new Vortex(board, 24, 4); Vortex vn22 = new Vortex(board, 25, 4); Vortex vn23 = new Vortex(board, 26, 4); Vortex vn24 = new Vortex(board, 27, 4); Vortex vn25 = new Vortex(board, 28, 4); Vortex vs1 = new Vortex(board, 4, 19); Vortex vs2 = new Vortex(board, 5, 19); Vortex vs3 = new Vortex(board, 6, 19); Vortex vs4 = new Vortex(board, 7, 19); Vortex vs5 = new Vortex(board, 8, 19); Vortex vs6 = new Vortex(board, 9, 19); Vortex vs7 = new Vortex(board, 10, 19); Vortex vs8 = new Vortex(board, 11, 19); Vortex vs9 = new Vortex(board, 12, 19); Vortex vs10 = new Vortex(board, 13, 19); Vortex vs11 = new Vortex(board, 14, 19); Vortex vs12 = new Vortex(board, 15, 19); Vortex vs13 = new Vortex(board, 16, 19); Vortex vs14 = new Vortex(board, 17, 19); Vortex vs15 = new Vortex(board, 18, 19); Vortex vs16 = new Vortex(board, 19, 19); Vortex vs17 = new Vortex(board, 20, 19); Vortex vs18 = new Vortex(board, 21, 19); Vortex vs19 = new Vortex(board, 22, 19); Vortex vs20 = new Vortex(board, 23, 19); Vortex vs21 = new Vortex(board, 24, 19); Vortex vs22 = new Vortex(board, 25, 19); Vortex vs23 = new Vortex(board, 26, 19); Vortex vs24 = new Vortex(board, 27, 19); Vortex vs25 = new Vortex(board, 28, 19); Vortex ve1 = new Vortex(board, 28, 5); Vortex ve2 = new Vortex(board, 28, 6); Vortex ve3 = new Vortex(board, 28, 7); Vortex ve4 = new Vortex(board, 28, 8); Vortex ve5 = new Vortex(board, 28, 9); Vortex ve6 = new Vortex(board, 28, 10); Vortex ve7 = new Vortex(board, 28, 11); Vortex ve8 = new Vortex(board, 28, 12); Vortex ve9 = new Vortex(board, 28, 13); Vortex ve10 = new Vortex(board, 28, 14); Vortex ve11 = new Vortex(board, 28, 15); Vortex ve12 = new Vortex(board, 28, 16); Vortex ve13 = new Vortex(board, 28, 17); Vortex ve14 = new Vortex(board, 28, 18); Vortex vw1 = new Vortex(board, 4, 5); Vortex vw2 = new Vortex(board, 4, 6); Vortex vw3 = new Vortex(board, 4, 7); Vortex vw4 = new Vortex(board, 4, 8); Vortex vw5 = new Vortex(board, 4, 9); Vortex vw6 = new Vortex(board, 4, 10); Vortex vw7 = new Vortex(board, 4, 11); Vortex vw8 = new Vortex(board, 4, 12); Vortex vw9 = new Vortex(board, 4, 13); Vortex vw10 = new Vortex(board, 4, 14); Vortex vw11 = new Vortex(board, 4, 15); Vortex vw12 = new Vortex(board, 4, 16); Vortex vw13 = new Vortex(board, 4, 17); Vortex vw14 = new Vortex(board, 4, 18); vortexes = new Vortex[78] { vn1, vn2, vn3, vn4, vn5, vn6, vn7, vn8, vn9, vn10, vn11, vn12, vn13, vn14, vn15, vn16, vn17, vn18, vn19, vn20, vn21, vn22, vn23, vn24, vn25, vs1, vs2, vs3, vs4, vs5, vs6, vs7, vs8, vs9, vs10, vs11, vs12, vs13, vs14, vs15, vs16, vs17, vs18, vs19, vs20, vs21, vs22, vs23, vs24, vs25, ve1, ve2, ve3, ve4, ve5, ve6, ve7, ve8, ve9, ve10, ve11, ve12, ve13, ve14, vw1, vw2, vw3, vw4, vw5, vw6, vw7, vw8, vw9, vw10, vw11, vw12, vw13, vw14 }; }
// Use this for initialization void Start() { vortex = GetComponentInChildren <Vortex>(); vortexAmplitude = Mathf.Abs(vortex.angle); }
/* Warp the player to another era. */ private void Warp(Vortex vortex) { vortex.OnWarp(); vortexCooldownTimeRemaining = vortexCooldown; }
public void Initialize() { gameOverPosition.X = 320; gameOverPosition.Y = 130; device = graphics.GraphicsDevice; // set up all basic game objects for level1 here gameState = new GameState(); gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight); gameStart2 = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight); board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight)); darwin = new Darwin(board); firstZombie = new Zombie(10, 10, 15, 5, 15, 5, board); secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board); thirdZombie = new Zombie(12, 10, 15, 5, 15, 5, board); fourthZombie = new Zombie(20, 7, 27, 15, 22, 2, board); fifthZombie = new Zombie(22, 10, 25, 15, 22, 2, board); sixthZombie = new Zombie(21, 4, 25, 15, 15, 2, board); String zombieString = "This a zombie,\n don't near him \nas a human!!"; zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString); String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions"; darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString); String switchString = "This is a switch\n face it and press A\n to see what happens!!"; switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString); String brainString = "Move the brain as a \nzombie.\n Zombie's like brains!!"; brainMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, brainString); stairs = new Stairs(board); brain = new Brain(board, 3, 3); BasicObject[] removableWalls = setRemovableWallsInLevelOne(); BasicObject switchSquare = new BasicObject(board); switchSquare.X = 13; switchSquare.Y = 2; firstSwitch = new Switch(switchSquare, board, removableWalls); // Initial starting position darwin.setGridPosition(2, 20); if (board.isGridPositionOpen(darwin)) { board.setGridPositionOccupied(darwin.X, darwin.Y); darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y); } // Darwin's lag movement counterReady = counter = 5; if (board.isGridPositionOpen(21, 20)) { stairs.setGridPosition(27, 21); stairs.setDestination(board.getPosition(27, 21)); } zTime = new ZombieTime(board); vortex = new Vortex(board, 19, 20); setPotionPosition(25, 4); setWalls(); }
private void Awake() { spline = gameObject.GetComponent <spline>(); frenet = gameObject.GetComponent <frenet>(); vortex = gameObject.GetComponent <Vortex>(); }