public void ReWritePowerUp(PowerUpType powerUP) { var num = powerUps[powerUP]; //UNCOMMENT WHEN ASSETS READY //var icons = gameObject.GetComponentsInChildren<Transform>(); //foreach(var i in icons) { // Destroy(i); //} if (num == 0) { powerUPText.text = ""; return; } //var icon = powerUpIcon[powerUP]; for (int i = 0; i < num; i++) { powerUPText.text += powerUpChar; //UNCOMMENT WHEN ASSETS READY //var vec = powerUpContainer.transform.position; //vec.x += i * width; //var sprite = Instantiate(icon, vec, Quaternion.identity) as GameObject; } }
/// <summary> /// Function that starts the power up timer /// </summary> public void StartTimer(float timer, Action powerUpActive, PowerUpType powerUpType) { transform.parent.gameObject.SetActive(true); circleTimer.fillAmount = 1; maxTimer = timer; this.timer = maxTimer; this.powerUpActive = powerUpActive; switch (powerUpType) { case PowerUpType.AvoidMonster: icon.sprite = meatSprite; break; case PowerUpType.FixProblems: icon.sprite = KcafSprite; break; case PowerUpType.AvoidWeatherEvent: icon.sprite = weatherSprite; break; default: throw new ArgumentOutOfRangeException(nameof(powerUpType), powerUpType, null); } }
/// <summary> /// Initializes a new instance of the <see cref="PowerUp"/> class. /// </summary> /// <param name="physicsWorld">The physics world.</param> /// <param name="spriteBatch">The sprite batch to use for rendering.</param> /// <param name="contentManager">The game's content manager.</param> /// <param name="description">The entity description.</param> /// <param name="settings">The power up settings.</param> public PowerUp(ref World physicsWorld, SpriteBatch spriteBatch, ContentManager contentManager, InteractiveEntityDescription description, PowerUpSetting settings) : base(ref physicsWorld, description) { this.name = settings.Name; this.timeOfEffect = settings.TimeOfEffect; switch (this.name) { case EntityConstants.InvincibleName: this.type = PowerUpType.Invincibility; break; case EntityConstants.HealthName: this.type = PowerUpType.Health; break; case EntityConstants.JumpName: this.type = PowerUpType.Jump; break; case EntityConstants.SpeedName: this.type = PowerUpType.Speed; break; default: this.type = PowerUpType.None; break; } this.PhysicsBody.UserData = new InteractiveEntityUserData(InteractiveEntityType.PowerUp, this.timeOfEffect, this.type); this.InitializeAndLoad(spriteBatch, contentManager); }
private void InitializeMemberVariables(PowerUpType aPowerUpType) { myIsOpen = false; myHasSpawnedPowerUp = false; myFrameXIndex = 0; PowerUpType = aPowerUpType; }
public BlockAtrributes(int health, GameColor color, PowerUpType favoredPowerUp, PowerUpType secondaryFavoredPowerUp = PowerUpType.Nothing) { Health = health; Color = color; FavoredPowerUp = favoredPowerUp; SecondaryFavorePowerUp = secondaryFavoredPowerUp; }
private void OnPowerUpDrop(PowerUpType type, Point position) { if (PowerUpDrop != null) { PowerUpDrop(type, position); } }
public IEnumerator GetPowerBack(PowerUpType powerUpType) { PowerUp powerUp = PowerUpManager.powerUpManager.powerUps .FirstOrDefault(s => s.powerUpType == powerUpType); if (PowerUpType.MachineGun == powerUp.powerUpType) { Debug.Log("machine gun 1"); yield return(new WaitForSeconds(powerUp.usingTime)); pShoot.NormalShootTimeLimit = powerUp.tempData[0]; pShoot.canRecoil = true; p.isThereActivePowerUp = false; } else if (powerUp.powerUpType == PowerUpType.UnPerfectShield) { Debug.Log("UnPerfect Shield 1"); yield return(new WaitForSeconds(powerUp.usingTime)); p.dontGetDamage = false; pShoot.canShoot = true; p.isThereActivePowerUp = false; } else if (powerUp.powerUpType == PowerUpType.ExplosivePower) { Debug.Log("Explosve Power 1"); ProjectileManager manager = FindObjectOfType <ProjectileManager>(); manager.NormalRecoilForce /= 2; manager.MiddleRecoilForce /= 2; manager.PowerfulRecoilForce /= 2; p.isThereActivePowerUp = false; } }
public DMPowerUpSpawner(PowerUpType type) : base() { PowerUp = type; Visible = true; Movable = false; }
public Item(Coordinate position, ItemType type, int value, PowerUpType powerUpType = PowerUpType.None) { Position = position; Type = type; Value = value; PowerUpType = powerUpType; }
public PowerUp(Vector2 pos, PowerUpType type) { _id = Guid.NewGuid(); _pos = pos; _type = type; _collected = false; }
public void Execute(PowerUpType type, int targetSlotIndex, List <KulaySlot> boardSlots, int boardSideCount, BoosterHandler boosterHandler) { var affectedIndexes = new List <int> { targetSlotIndex }; switch (type) { case PowerUpType.None: return; case PowerUpType.VerticalSlice: affectedIndexes.AddRange(targetSlotIndex.GetAdjacentLineIndex(boardSideCount, false)); PopSlots(affectedIndexes, boardSlots, boosterHandler, boardSideCount); break; case PowerUpType.HorizontalSlice: affectedIndexes.AddRange(targetSlotIndex.GetAdjacentLineIndex(boardSideCount, true)); PopSlots(affectedIndexes, boardSlots, boosterHandler, boardSideCount); break; case PowerUpType.ClearSlot: PopSlots(affectedIndexes, boardSlots, boosterHandler, boardSideCount); break; case PowerUpType.Shuffle: Shuffle(boardSlots); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
/// <summary> /// Set picked powerup /// </summary> /// <param name="powerup">Object to check if this method was called from the powerup object itself</param> public void SetPowerUp(object powerup) { if (powerup is PowerUp up) { this.powerup = up.powerUpType; } }
public void HandlePowerup(PowerUpType powerUp) { Debug.Print("handling powerup"); Debug.Print("set the timer"); switch (powerUp) { case PowerUpType.OPSmaller: spriteScale = 0.75f; Practicum1.TimerManager.setTimer(timerName + "1", 7.5f); Debug.Print("applying smaller powerup for " + name); break; case PowerUpType.OPSlower: newVelocity = baseVelocity / 2; Practicum1.TimerManager.setTimer(timerName, 7.5f); Debug.Print("applying slower powerup for " + name); break; case PowerUpType.TPBigger: spriteScale = 1.5f; Practicum1.TimerManager.setTimer(timerName + "1", 7.5f); Debug.Print("applying bigger powerup for " + name); break; case PowerUpType.TPFaster: newVelocity = baseVelocity * 2; Practicum1.TimerManager.setTimer(timerName, 7.5f); Debug.Print("applying faster powerup for " + name); break; default: break; } }
public PowerUp(PowerUpType type_, Vector2 pos) { type = type_; sprite = PowerUpManager.PowerUpTextures[type.ToString()]; position = pos; base.Initialize(); }
private GameObject PrefabForType(PowerUpType type) { switch (type) { case PowerUpType.Acceleration: { return(AccelerationPowerUp); } case PowerUpType.Torque: { return(RotationPowerUp); } case PowerUpType.Shoot: { return(BlastersPowerUp); } case PowerUpType.Shield: { return(ShieldPowerUp); } default: { return(AccelerationPowerUp); } } }
protected Tank( ISoundManager soundManager, World world, Collection<IDoodad> doodads, Team team, Vector2 position, float rotation, DoodadFactory doodadFactory) { this.soundManager = soundManager; this.world = world; this.doodadFactory = doodadFactory; this.doodads = doodads; this.body = BodyFactory.CreateBody(world, position, this); this.body.Rotation = rotation; this.body.BodyType = BodyType.Dynamic; this.Team = team; this.Heading = rotation; this.activeMissiles = new List<Missile>(); this.powerup = PowerUpType.None; var shape = new PolygonShape(0); shape.SetAsBox(15 / Constants.PixelsPerMeter, 15 / Constants.PixelsPerMeter); var fixture = this.body.CreateFixture(shape); fixture.CollisionCategories = this.CollisionCategory; fixture.CollidesWith = PhysicsConstants.MissileCategory; if (this is PlayerControlledTank) { fixture.CollidesWith |= PhysicsConstants.ObstacleCategory | PhysicsConstants.PitCategory | PhysicsConstants.SensorCategory; } }
public PowerUp(Texture2D t, PowerUpType ty, List<List<Vector3>> points, Effect e) { texture = t; type = ty; effect = e; setUpVertices(points); }
/// <summary> /// Generates a new power-up and activates it /// </summary> public void ResetAndActivate() { _type = (PowerUpType)Functions.Rand(0, 7); _position.Y = 15; _position.X = Functions.Rand(20, Functions.GameSize.X - 20); _isActive = true; }
public void Spawn(PowerUpType type) { isActive = true; this.powerUpCollider.enabled = true; this.type = type; switch (type) { case PowerUpType.Speed: this.spriteRenderer.sprite = powerUpManager.speedPowerUpSprite; break; case PowerUpType.ShootSpeed: this.spriteRenderer.sprite = powerUpManager.shootSpeedPowerUpSprite; break; case PowerUpType.FireRate: this.spriteRenderer.sprite = powerUpManager.fireRatePowerUpSprite; break; case PowerUpType.Invisibility: this.spriteRenderer.sprite = powerUpManager.invisibilityPowerUpSprite; break; default: break; } }
public static void Init(List <Player> players) { guiScores = new Dictionary <Player, GuiNumber>(); guiPowerUps = new Dictionary <Player, List <GUIItem> >(); for (int i = 0; i < players.Count; i++) { Player currPlayer = players[i]; GUIItem guiImage = new GUIItem(currPlayer.GUIPosition, currPlayer.GUIImage); Vector2 scorePosition = guiImage.Position + new Vector2(0, guiImage.Height / 2) + new Vector2(-2, 2); guiScores[currPlayer] = new GuiNumber(scorePosition, "0000000"); guiPowerUps[currPlayer] = new List <GUIItem>(); int numPowerUps = Enum.GetValues(typeof(PowerUpType)).Length; Vector2 offset = new Vector2(0, 1); for (int j = 0; j < numPowerUps; j++) { PowerUpType type = (PowerUpType)j; GUIItem g = new PowerUpGUIItem(scorePosition + offset, type); guiPowerUps[currPlayer].Add(g); offset += new Vector2(1, 0); } } }
public PowerUpGUIItem(Vector2 spritePosition, PowerUpType type) : base(spritePosition, "speedUp") { Type = type; Enabled = false; sprite.SetMultiplyTint(colorDisabled); switch (type) { //mettere costanti nelle classi case PowerUpType.SpeedUp: texture = GfxManager.GetSpritesheet("speedUp").Item1; break; case PowerUpType.SpeedDown: texture = GfxManager.GetSpritesheet("speedDown").Item1; break; case PowerUpType.BombUp: texture = GfxManager.GetSpritesheet("bombUp").Item1; break; case PowerUpType.BombDown: texture = GfxManager.GetSpritesheet("bombDown").Item1; break; case PowerUpType.Invincibility: texture = GfxManager.GetSpritesheet("invincibility").Item1; break; case PowerUpType.ExtraLife: texture = GfxManager.GetSpritesheet("extraLife").Item1; break; } }
public void PowerUp(PowerUpType type, PlayerController player) { switch (type) { case PowerUpType.StaminaUp: StaminaUp(player); break; case PowerUpType.Heavier: Heavier(player); break; case PowerUpType.Speed: Speed(player); break; case PowerUpType.Freeze: Freeze(player); break; case PowerUpType.Donkey: Donkey(player); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public void ShowNotification(string text, PowerUpType type) { if (notification.activeSelf) { StartCoroutine(Wait(text, type)); } else { if (type == PowerUpType.Good) { notificationText.color = Color.green; } else if (type == PowerUpType.Bad) { notificationText.color = Color.red; } else { notificationText.color = Color.yellow; } notificationText.text = text; notification.SetActive(true); } }
/// <summary> /// Handles powerup picked up event /// </summary> public void OnPowerUpPickedUp(PowerUpType powerUpType) { if (powerUpType == PowerUpType.God) { _godPowerUpActive = true; } }
void Start() { YCounter = MinY; YCounterDirection = true; Type = PowerUpType.None; OverheadCamera = GameObject.FindGameObjectWithTag("OverheadCamera").GetComponent <Camera>(); }
public GameObject RequestPowerup(string player) { xPos = Random.Range(-6.5f, 6.5f); yPos = Random.Range(-2.5f, 1.5f); randomPos = new Vector3(xPos, yPos); pType = (PowerUpType)Random.Range(0, 3); //pType = (PowerUpType)Random.Range(0,) foreach (GameObject item in powerUpList) { if (!item.activeInHierarchy) { Debug.Log("Spawning Powerup"); //item is Available and will spawn a random powerup item.transform.position = randomPos; item.SetActive(true); item.GetComponent <PowerUp>().SpawnPowerUp(pType, player); return(item); } } GameObject newItem = Instantiate(powerUpPrefab, powerupContainer); newItem.transform.position = randomPos; powerUpList.Add(newItem); return(newItem); //need to create new item //if we made it to this pooint, we need to generate more items //when an item is picked up, setactive to false }
public void Initialize() { ActualSelection = new SimPlayerSelection(); LastSelection = new SimPlayerSelection(); TurretToBuyController = new SelectedTurretToBuyAllController(AvailableTurrets); SelectedCelestialBodyController = new SelectedCelestialBodyController(Simulator, this, CelestialBodies); SelectedPowerUpController = new SelectedPowerUpController(Simulator.PowerUpsFactory.Availables, Circle); PowerUpInUse = PowerUpType.None; MovingLeft = MovingRight = MovingUp = MovingDown = false; LastMouseDirection = Vector3.Zero; GameOver = false; Firing = false; if (BasePlayer.InputType == Core.Input.InputType.Mouse) { SpaceshipMove.SteeringBehavior = new SpaceshipMouseMBehavior(SpaceshipMove); PausePlayer.SpaceshipMove.SteeringBehavior = new SpaceshipMouseMBehavior(PausePlayer.SpaceshipMove); } else if (BasePlayer.InputType == Core.Input.InputType.Gamepad) { SpaceshipMove.SteeringBehavior = new SpaceshipGamePadMBehavior(SpaceshipMove); PausePlayer.SpaceshipMove.SteeringBehavior = new SpaceshipGamePadMBehavior(PausePlayer.SpaceshipMove); } }
IEnumerator Wait(string text, PowerUpType type) { yield return(new WaitForSeconds(1f)); ShowNotification(text, type); yield break; }
public DMPowerUpSpawner() : base() { PowerUp = PowerUpType.Str; Visible = true; Movable = false; }
void ActivateProperModel(PowerUpType type) { switch (type) { case PowerUpType.WEAPON: activeModel = weaponModel; repairModel.SetActive(false); reloadModel.SetActive(false); break; case PowerUpType.REPAIR: weaponModel.SetActive(false); activeModel = repairModel; reloadModel.SetActive(false); break; case PowerUpType.RELOAD: weaponModel.SetActive(false); repairModel.SetActive(false); activeModel = reloadModel; break; default: throw new UnityException("Unknown PowerUp-Type \"" + type.ToString() + "\""); } activeModel.SetActive(true); }
private void OnTriggerEnter2D(Collider2D collision) { string tag = collision.tag; if (tag == "PowerUp") { AudioSource.PlayClipAtPoint(_powerUpSound, transform.position); PowerUpType type = collision.GetComponent <PowerUp>().GetPowerUpType(); switch (type) { case PowerUpType.Shield: shield.SetActive(true); shieldSecond = shieldSecond + powerUpPeriod; inShieldPeriod = true; break; case PowerUpType.Speed: speedUpSecond = speedUpSecond + powerUpPeriod; _speed = speedOriginal + speedUpValue; inSpeedUpPeriod = true; break; case PowerUpType.Triple: tripleShootSecond = tripleShootSecond + powerUpPeriod; inTripleShootPeriod = true; break; } Destroy(collision.gameObject); } else if (tag == "Enemy" || tag == "EnemyLaser") { DamageByOne(); } }
public void ApplyPowerUp(PowerUpType type) { Audio.Instance.PlayBuildInSound(Audio.BuildInSound.BonusPickup); int index = (int)type; if (index >= 0 && index < _powerUpInfoCount) { _powerUpInfos[index].Activate(); } //switch(type) //{ // case PowerUpType.NCaptureSlower: // _captureSlowerTimer = 0f; // StartCoroutine(CaptureSlowerEnumerator()); // break; // case PowerUpType.NDirectionSwapper: // _directionSwapperTimer = 0f; // StartCoroutine(DirectionSwapperEnumerator()); // break; // case PowerUpType.PCaptureBooster: // _captureBoosterTimer = 0f; // StartCoroutine(CaptureBoosterEnumerator()); // break; // case PowerUpType.PLightEnlarger: // _lightEnlargerTimer = 0f; // StartCoroutine(LightEnlargerEnumerator()); // break; //} }
private void OnPowerUpPickUp(int playerId, Point position, PowerUpType type) { if (PowerUpPickUp != null) { PowerUpPickUp(playerId, position, type); } }
public PowerUpScript(int index) { type = (PowerUpType)index; switch (type) { case PowerUpType.BonusDamage: Code = "attack"; break; case PowerUpType.BonusAttackSpeed: Code = "attackspeed"; break; case PowerUpType.BonusMovementSpeed: Code = "movementspeed"; break; case PowerUpType.BonusCriticalChance: Code = "Critical"; break; case PowerUpType.BonusSpeed: Code = "Speed"; break; case PowerUpType.HealOverTime: Code = "Regen"; break; } }
public void TriggerPowerUp(Player player, PowerUpType powerUpType) { AudioManager.instance.PlayBonusSound(); switch (powerUpType) { case PowerUpType.ThreeBall: AddBall(3); break; case PowerUpType.FiveBall: AddBall(5); break; case PowerUpType.GoalSizeIncrease: IncreaseGoalSize(_powerUpSettings.goalIncreaseRatio, GetPlayerTeam(player)); break; case PowerUpType.GoalSizeDecrease: DecreaseGoalSize(_powerUpSettings.goalDecreaseRatio, GetPlayerTeam(player)); break; case PowerUpType.PlayerSizeIncrease: IncreasePlayerSize(_powerUpSettings.playerIncreaseRatio, player); break; case PowerUpType.MultiGoal: MultiGoal(GetPlayerTeam(player)); break; case PowerUpType.MagneticField: //MagneticField (); break; } }
public void addFood(int x, int y, bool isBuff, PowerUpType powerUpType, int random) { AbstractPowerUpFactory powerUpFactory = PowerUpFactoryProducer.getFactory(isBuff); PowerUp sizePowerUp = powerUpFactory.getPowerUp(x, y, powerUpType, random); PowerUps.Add(sizePowerUp); }
public PowerUp(Texture2D t, PowerUpType ty, Vector2 c, Effect e) { texture = t; type = ty; effect = e; center = c; setVerts(c); }
protected BasePowerUp(Point position) : base(position) { Type = GameConfiguration.PowerUpTypeAvailable[ GameConfiguration.Random.Next( GameConfiguration.PowerUpTypeAvailable.Count)]; DestructionTime = GameConfiguration.PowerUpDestructionTime; }
public void GivePowerUp(PowerUpType powerup) { // reset any settings that might have been affected by previous power ups speed = DEFAULT_SPEED; // set time that new power up was aquired powerUpTime = DateTime.Now; this.powerup = powerup; if (this.powerup == PowerUpType.Speed) speed = 0.07f; }
public SelectedPowerUpController(Dictionary<PowerUpType, PowerUp> powerUps, Circle cursorCircle) { PowerUps = powerUps; CursorCircle = cursorCircle; PowerUpToBuy = PowerUpType.None; PowerUpsCircles = new Dictionary<PowerUpType, Circle>(PowerUpTypeComparer.Default); foreach (var powerUp in PowerUps) PowerUpsCircles.Add(powerUp.Key, new Circle(powerUp.Value.BuyPosition, 10)); }
public void Update() { PowerUpToBuy = PowerUpType.None; foreach (var powerUp in PowerUpsCircles) { powerUp.Value.Position = PowerUps[powerUp.Key].BuyPosition; if (Physics.CircleCicleCollision(powerUp.Value, CursorCircle)) PowerUpToBuy = powerUp.Key; } }
public float AbsorbColor(PowerUpType type) { for (int i = 0; i < colors.Count; i++) { if (colors[i].Type == type) { float amountToReturn = colors[i].amount; colors[i].amount = 0; return amountToReturn; } } return 0; }
public PowerUp(GameplayManager gm, World world, Vector2 position, PowerUpType type) : base(world) { this.gm = gm; this.type = type; body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(40), ConvertUnits.ToSimUnits(40), 1, position); body.BodyType = BodyType.Dynamic; body.CollidesWith = Category.Cat2; body.CollisionCategories = Category.Cat3; body.OnCollision += OnCollision; body.UserData = this; body.ApplyLinearImpulse(new Vector2(0, 1.0f)); }
public override void setUpPowerUp(PowerUpType powerUpType) { float arenaHalfLength = GameController.Instance.ARENA_HALF_LENGTH; gameObject.transform.position = new Vector3(0, RandomUtility.randomNegativeOrPositive() * Random.Range(100, arenaHalfLength), 0); switch (powerUpType) { case PowerUpType.LONG: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[0]; particles.GetComponent<ParticleSystem>().startColor = buff; GetComponent<SpriteRenderer>().sprite = ballSprites[0]; break; case PowerUpType.SHIELD: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[1]; particles.GetComponent<ParticleSystem>().startColor = buff; GetComponent<SpriteRenderer>().sprite = ballSprites[0]; break; case PowerUpType.SHORT: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[5]; particles.GetComponent<ParticleSystem>().startColor = nerf; GetComponent<SpriteRenderer>().sprite = ballSprites[1]; break; case PowerUpType.SPEED: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[2]; particles.GetComponent<ParticleSystem>().startColor = nerf; GetComponent<SpriteRenderer>().sprite = ballSprites[1]; break; case PowerUpType.DOUBLE: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[4]; particles.GetComponent<ParticleSystem>().startColor = nerf; GetComponent<SpriteRenderer>().sprite = ballSprites[1]; break; case PowerUpType.NO_GOALS: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[6]; particles.GetComponent<ParticleSystem>().startColor = neutral; GetComponent<SpriteRenderer>().sprite = ballSprites[2]; break; case PowerUpType.MOVING_GOALS: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[9]; particles.GetComponent<ParticleSystem>().startColor = neutral; GetComponent<SpriteRenderer>().sprite = ballSprites[2]; break; case PowerUpType.COIN: logo.GetComponent<SpriteRenderer>().sprite = logoSprites[10]; gameObject.transform.position += new Vector3(RandomUtility.randomNegativeOrPositive() * GameController.Instance.DISTANCE_FROM_GOAL, 0, 0); particles.GetComponent<ParticleSystem>().startColor = coin; GetComponent<SpriteRenderer>().sprite = ballSprites[3]; break; } }
/// <summary> /// Initializes a new instance of the <see cref="PowerUp"/> class. /// </summary> /// <param name="position">The position.</param> /// <param name="actualTile">The actual tile.</param> public PowerUp(Vector2 position, Tile actualTile) { //this.drawing = drawing; this.position = position; this.actualTile = actualTile; int rnGesus = rand.Next(2); if (rnGesus == 0) type = PowerUpType.star; else type = PowerUpType.weapon; duration = new Timer(LIFESPAN); duration.Elapsed += ExpirationTimeHasPassed; duration.Enabled = true; hasExpired = false; }
public void DoActivatePowerUpAsked(PowerUpType type, SimPlayer player) { ActivesPowerUps[type] = false; PowerUp p = Simulator.PowerUpsFactory.Create(type); p.Owner = player; p.Start(); PowerUps[player].Add(p); if (p.NeedInput) player.PowerUpInUse = p.Type; NotifyPowerUpStarted(p, player); }
public Texture2D TextureFromPowerUpType(PowerUpType tempType, ContentManager Content) { Debug.Print(name + " has chosen " + tempType); switch (tempType) { case PowerUpType.OPSmaller: return OPSmallerspr; case PowerUpType.OPSlower: return OPSlowerspr; case PowerUpType.TPBigger: return TPBiggerspr; case PowerUpType.TPFaster: return TPFasterspr; default: return Content.Load<Texture2D>(""); } }
public SimPlayer(Simulator simulator, Player player) { Simulator = simulator; BasePlayer = player; PowerUpInUse = PowerUpType.None; SpaceshipMove = new SpaceshipSpaceship(simulator) { Speed = 4, VisualPriority = VisualPriorities.Default.PlayerCursor }; SpaceshipMove.Bounced += new NoneHandler(DoBouncing); TurretToPlaceChanged = false; GameOver = false; VibrationMetronome = new Metronome(Preferences.TargetElapsedTimeMs, 100); }
public void SpawnPowerUp(float x, float z) { position = new Vector3(x, 0, z); Quaternion rot = new Quaternion(0, 0, 0, 0); int rand = Random.Range(1,4); if ( rand == 1){ instantiatedPowerUp = Instantiate(PowerUp1, position, rot) as Rigidbody; powerUpType = PowerUpType.ReduceSize; } if ( rand == 2){ instantiatedPowerUp = Instantiate(PowerUp2, position, rot) as Rigidbody; powerUpType = PowerUpType.IncreaseHealth; } if (rand == 3){ instantiatedPowerUp = Instantiate(PowerUp3, position, rot) as Rigidbody; powerUpType = PowerUpType.SlowDown; } }
public PowerUp Create(PowerUpType type) { PowerUp t = null; switch (type) { case PowerUpType.Collector: t = new PowerUpCollector(Simulator, HumanBattleship); break; case PowerUpType.FinalSolution: t = new PowerUpLastSolution(Simulator); break; case PowerUpType.Spaceship: t = new PowerUpSpaceship(Simulator, HumanBattleship); break; case PowerUpType.DeadlyShootingStars: t = new PowerUpDeadlyShootingStars(Simulator); break; case PowerUpType.RailGun: t = new PowerUpRailGun(Simulator, HumanBattleship); break; case PowerUpType.AutomaticCollector: t = new PowerUpAutomaticCollector(Simulator, HumanBattleship); break; case PowerUpType.DarkSide: t = new PowerUpDarkSide(Simulator); break; case PowerUpType.Miner: t = new PowerUpMiner(Simulator, HumanBattleship); break; case PowerUpType.Pulse: t = new PowerUpPulse(Simulator); break; case PowerUpType.Shield: t = new PowerUpShield(Simulator); break; default: t = new PowerUpCollector(Simulator, HumanBattleship); break; } return t; }
public PowerUp( Level spriteManager, Vector2 startPosition , PowerUpType powerUpType) { level = spriteManager; intializeData(spriteManager); this.isConsumed = false; this.position = startPosition; this.position.X += (Math.Abs(speed.X) / speed.X) * 70; this.powerUpType = powerUpType; switch (powerUpType) { case PowerUpType.Heart: textureIndex = 0; break; case PowerUpType.DogFood: textureIndex = 2; break; default: textureIndex = 1; break; } }
public AeroObject() { content = AeroGame.ContentManager; //spriteBatch = new SpriteBatch(AeroGame.Graphics.GraphicsDevice); rotation = new Matrix(); boundingRectangle = new Rectangle(); scale = 1; //Bounding Rectangle Data leftTop = Vector2.Zero; rightTop = Vector2.Zero; leftBottom = Vector2.Zero; rightBottom = Vector2.Zero; min = Vector2.Zero; max = Vector2.Zero; alive = false; exploding = false; friendly = false; type = PowerUpType.None; isHit = false; hitTimeout = 0.1f; color = Color.White; }
public PowerUp( ISoundManager soundManager, World world, Random random, Collection<IDoodad> doodads, Vector2 position, DoodadFactory doodadFactory) { this.soundManager = soundManager; this.doodadFactory = doodadFactory; this.world = world; this.doodads = doodads; this.body = BodyFactory.CreateBody(world, position, this); this.body.BodyType = BodyType.Dynamic; this.body.FixedRotation = true; PowerUpType powerUpType = PowerUpType.None; switch (random.Next(3)) { case 0: powerUpType = PowerUpType.Speed; break; case 1: powerUpType = PowerUpType.UnlimitedAmmo; break; case 2: powerUpType = PowerUpType.ExtraBounce; break; } this.powerUp = powerUpType; CircleShape shape = new CircleShape(5 / Constants.PixelsPerMeter, 0.1f); Fixture fixture = body.CreateFixture(shape); fixture.IsSensor = true; fixture.CollisionCategories = PhysicsConstants.SensorCategory; fixture.CollidesWith = PhysicsConstants.PlayerCategory; }
/// <summary> /// Constructor /// </summary> public PowerUp(Texture2D texture, PowerUpType type, Vector2 initialPosition) { xOrigin = initialPosition.X; yOrigin = initialPosition.Y; xPos = (int)initialPosition.X; yPos = (int)initialPosition.Y; health = 1; maxHealth = 1; waveTheta = 0.0; team = Team.PowerUp; powerUpType = type; Rectangle src_rect; switch (type) { case PowerUpType.invulnerability: case PowerUpType.missile: case PowerUpType.railgun: case PowerUpType.repair: case PowerUpType.shield: default: { src_rect = new Rectangle(72, 2, 24, 25); break; } } sprite = new Sprite(texture, src_rect, 2.0); }
public PowerUpView(PowerUp powerup) { this.powerup = powerup; this.powerUpType = this.powerup.powerUp; }
public void AddPowerUp(PowerUpType type, Point position) { var powerUp = new PowerUp(position, type); PowerUpList.Add(powerUp); base.AddPowerUp(powerUp); }
public void HandlePowerup(PowerUpType powerUp) { Debug.Print("handling powerup"); Debug.Print("set the timer"); switch(powerUp) { case PowerUpType.OPSmaller: spriteScale = 0.75f; Practicum1.TimerManager.setTimer(timerName + "1", 7.5f); Debug.Print("applying smaller powerup for " + name); break; case PowerUpType.OPSlower: newVelocity = baseVelocity / 2; Practicum1.TimerManager.setTimer(timerName, 7.5f); Debug.Print("applying slower powerup for " + name); break; case PowerUpType.TPBigger: spriteScale = 1.5f; Practicum1.TimerManager.setTimer(timerName + "1", 7.5f); Debug.Print("applying bigger powerup for " + name); break; case PowerUpType.TPFaster: newVelocity = baseVelocity * 2; Practicum1.TimerManager.setTimer(timerName, 7.5f); Debug.Print("applying faster powerup for " + name); break; default: break; } }
public PowerUp(Point cellPosition, PowerUpType type) : base(cellPosition) { Type = type; Initialize(); }
void RandomizeItem() { _powerUpType = (PowerUpType) Random.Range(0, PowerUpType.GetNames(typeof(PowerUpType)).Length); _powerUpTypesSprites[(int) _powerUpType].SetActive(true); }
private void NotifyDesactivatePowerUpAsked(PowerUpType type, SimPlayer player) { if (DesactivatePowerUpAsked != null) DesactivatePowerUpAsked(type, player); }