public void RegisterBoost(SpeedBoostSettings boostSettings) { SpeedBoost newBoost = new SpeedBoost(); boost = newBoost; boost.settings = boostSettings; }
public void CreateSpeedBoost(GameObject powerUp) //gives the speed boost effect to the given powerUp { powerUp.AddComponent <SpeedBoost>(); SpeedBoost speedBoost = powerUp.GetComponent <SpeedBoost>(); //(Makes the next few lines easier to read) speedBoost.speedIncrease = 1000000; }
void attach(WheelVehicle target) { Debug.Log("Attached"); SpeedBoost clone = Instantiate(sbPrefab); clone.Initialize(boost_Duration, target); target.stat.LoadEffect(clone); }
public void RemovesBoostFromPlayer() { var player = Substitute.For <ISpeedable>(); SpeedBoost powerup = new SpeedBoost(); powerup.Remove(player); player.Received().DefaultSpeed(); }
public void AppliesCustomBoostToPlayer() { var player = Substitute.For <ISpeedable>(); SpeedBoost powerup = new SpeedBoost(10f, 3f); powerup.Apply(player); player.Received().MultiplySpeed(3f); }
// Start is called before the first frame update void Start() { RunSpeedValue = RunningSpeed; WalkSpeedValue = WalkSpeed; CrouchSpeedValue = CrouchedSpeed; Motor = GetComponent <PlayerMotor>(); SpeedBoost = GetComponent <SpeedBoost>(); Collider = GetComponent <CapsuleCollider>(); if (GameObject.Find("Death")) { DeathItem = GameObject.Find("Death").GetComponent <PlayerDeath>(); } AxeArms.SetActive(false); }
public void SetBonus(BonusTypes bonusType) { switch (bonusType) { case BonusTypes.SpeedBoost: SpeedBoost speedBoost = GameObject.FindObjectOfType <SpeedBoost>(); if (speedBoost == null) { GameObject go = new GameObject(); go.name = "SpeedBoost"; speedBoost = go.AddComponent <SpeedBoost>(); } speedBoost.ApplyBonus(); break; case BonusTypes.IncreasePlatform: IncreasePlatform increasePlatform = GameObject.FindObjectOfType <IncreasePlatform>(); if (increasePlatform == null) { GameObject go = new GameObject(); go.name = "IncreasePlatform"; increasePlatform = go.AddComponent <IncreasePlatform>(); } increasePlatform.ApplyBonus(); break; case BonusTypes.CloneBall: CloneBall cloneBall = GameObject.FindObjectOfType <CloneBall>(); if (cloneBall == null) { GameObject go = new GameObject(); go.name = "CloneBall"; cloneBall = go.AddComponent <CloneBall>(); } cloneBall.ApplyBonus(); break; default: break; } }
public static void RemoveContext(Mobile m, AnimalFormContext context, bool resetGraphics) { m_Table.Remove(m); if (context.SpeedBoost) { m.Send(SpeedBoost.Instantiate(false)); } SkillMod mod = context.Mod; if (mod != null) { m.RemoveSkillMod(mod); } if (resetGraphics) { m.HueMod = -1; m.BodyMod = 0; } context.Timer.Stop(); }
private void Start() { if (!(myFuel = GetComponent <Fuel>())) { Debug.LogWarning("No Fuel-component attached!"); } if (!(myRigidbody = GetComponent <Rigidbody>())) { Debug.LogWarning("No Rigidbody-component attached!"); } if (!(mySpeedLineController = GetComponent <SpeedLineController>())) { Debug.LogWarning("No SpeedLineController-component attached!"); } if (!(mySpeedBoost = GetComponent <SpeedBoost>())) { Debug.LogWarning("No SpeedBoost-component attached!"); } else { mySpeedBoost.myOnSpeedBoost += SpeedBoost; } if (myPerfectColitionBox) { transform.localScale = new Vector3(1f, 1f, 1f); transform.GetChild(0).localScale = new Vector3(1f, 1f, 1f); } else { transform.localScale = new Vector3(0.65f, 1f, 1f); transform.GetChild(0).localScale = new Vector3(2.43f, 1.4774f, 1.4774f); } myCurrentVelocity = myStartingVelocity; }
public void SpeedBoostIdentifier() { SpeedBoost powerup = new SpeedBoost(null); Assert.AreEqual(Powerups.Speed, powerup.Identifier()); }
public void SpeedBoostCanBeInstantiatedWithNullDuration() { SpeedBoost powerup = new SpeedBoost(null); Assert.AreEqual(null, powerup.Duration()); }
public void SpeedBoostCanBeInstantiatedWithCustomDuration() { SpeedBoost powerup = new SpeedBoost(20f); Assert.AreEqual(20f, powerup.Duration()); }
public void SpeedBoostCanBeInstantiated() { SpeedBoost powerup = new SpeedBoost(); Assert.AreEqual(10f, powerup.Duration()); }
public static MorphResult Morph(Mobile m, int entryID) { if (entryID < 0 || entryID >= m_Entries.Length) { return(MorphResult.Fail); } AnimalFormEntry entry = m_Entries[entryID]; m_LastAnimalForms[m] = entryID; //On OSI, it's the last /attempted/ one not the last succeeded one if (m.Skills.Ninjitsu.Value < entry.ReqSkill) { string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu); m.SendLocalizedMessage(1063013, args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. return(MorphResult.NoSkill); } double ninjitsu = m.Skills.Ninjitsu.Value; if (ninjitsu < entry.ReqSkill + 37.5) { double chance = (ninjitsu - entry.ReqSkill) / 37.5; if (chance < Utility.RandomDouble()) { return(MorphResult.Fail); } } m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5); BaseMount.Dismount(m); m.BodyMod = entry.BodyMod; if (entry.HueMod > 0) { m.HueMod = entry.HueMod; } if (entry.SpeedBoost) { m.Send(SpeedBoost.Instantiate(true)); } SkillMod mod = null; if (entry.StealthBonus) { mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0); mod.ObeyCap = true; m.AddSkillMod(mod); } Timer timer = new AnimalFormTimer(m, entry.BodyMod, entry.HueMod); timer.Start(); AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type)); return(MorphResult.Success); }
public void Awake() { base.Awake(); Instance = this; }
// Update is called once per frame void Update() { if (RaceManager.Instance.raceStarted) { // Pause button if (Input.GetKeyDown(KeyCode.Escape)) { RaceManager.Instance.TogglePause(); } UpdateWheelPositions(); // Keeping your thicc butt attached to your car ButtShieldMesh.transform.position = gameObject.transform.position; ButtShieldMesh.transform.rotation = gameObject.transform.rotation; //Getting current powerup if (currentPowerup == null) { HUD.transform.GetChild(1).gameObject.transform.GetComponent <UnityEngine.UI.Image>().sprite = null; } else { if (activePowerup_Speed = currentPowerup.gameObject.GetComponent <SpeedBoost>()) { HUD.transform.GetChild(1).gameObject.transform.GetComponent <UnityEngine.UI.Image>().sprite = HUD_speed; } if (activePowerup_Shield = currentPowerup.gameObject.GetComponent <ButtShield>()) { HUD.transform.GetChild(1).gameObject.transform.GetComponent <UnityEngine.UI.Image>().sprite = HUD_shield; } if (activePowerup_Rocket = currentPowerup.gameObject.GetComponent <ButtRocket>()) { HUD.transform.GetChild(1).gameObject.transform.GetComponent <UnityEngine.UI.Image>().sprite = HUD_rocket; } } // Using Powerup if (Input.GetKeyDown(KeyCode.E)) { if (currentPowerup != null) { if (activePowerup_Speed = currentPowerup.gameObject.GetComponent <SpeedBoost>()) { activePowerup_Speed.SetTarget(this.gameObject); activePowerup_Speed.Fire(); } if (activePowerup_Shield = currentPowerup.gameObject.GetComponent <ButtShield>()) { activePowerup_Shield.SetTarget(this.gameObject); activePowerup_Shield.Fire(); } if (activePowerup_Rocket = currentPowerup.gameObject.GetComponent <ButtRocket>()) { activePowerup_Rocket.SetTarget(this.gameObject); activePowerup_Rocket.Fire(); } } } if (Input.GetKeyDown(KeyCode.R)) { RaceManager.Instance.PlayerRespawn(RaceManager.Instance.p_lastWaypoint, RaceManager.Instance.p_nextWaypoint); } } }
private void SpawnSpeedBoost() { spawnedBoost = Instantiate(boost, this.transform.position, Quaternion.identity).GetComponent <SpeedBoost>(); }