public Effect(Powerup.Type t, ParticleSystem pa, GameObject pr, EffectStatus s) { type = t; particles = pa; prop = pr; status = s; }
private GameObject PowerupModel(Powerup.Type type) { GameObject powerup; switch (type) { case Powerup.Type.BOOST: powerup = null; break; case Powerup.Type.POWER: powerup = atlas.coffee; break; case Powerup.Type.SHIELD: powerup = atlas.shield; break; default: powerup = null; break; } ; if (powerup == null) { powerup = GameObject.CreatePrimitive(PrimitiveType.Cube); // replace with model / prefab once decided } else { powerup = Instantiate(powerup); } return(powerup); }
private GameObject CreatePowerup(Powerup.Type type, Vector3 location) { FMODUnity.StudioEventEmitter sound = GetComponent <FMODUnity.StudioEventEmitter> (); if (sound != null) { sound.Play(); } GameObject powerup = PowerupModel(type); powerup.transform.localScale = Vector3.one * 2; powerup.transform.position = location + transform.position; powerup.transform.rotation = Quaternion.Euler(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360))); powerup.AddComponent <Rigidbody>(); powerup.AddComponent <SphereCollider> (); powerup.AddComponent <PowerupController>().type = type; ParticleSystem ps = Instantiate(spawnEffect); ps.transform.parent = powerup.transform; ps.transform.localPosition = powerup.GetComponent <SphereCollider> ().center; ParticleSystem.MinMaxGradient x = ps.main.startColor; x.color = Color.red; return(powerup); }
void SpawnPowerup() { Powerup.Type type = RandomPowerupType(); Vector3 location = RandomLocaitonInBounds(); CreatePowerup(type, location); }
public Buff CreateBuff(Powerup.Type type, Player target) { Buff b; b.target = target; b.type = type; b.timeLeft = durations[b.type]; return(b); }
public void GetPowerup(Powerup.Type type) { switch (type) { case Powerup.Type.BonusScore: Game.Instance.AddScore(100); break; default: throw new System.InvalidOperationException(); } }
// MY FUNCTIONS private int ItemTypeToSpriteIndex(Powerup.Type type) { switch (type) { case Powerup.Type.HighJump: return(0); case Powerup.Type.Invulnerable: return(1); case Powerup.Type.LiveUp: return(2); default: return(-1); } }
private Effect GetEfect(Powerup.Type type) { Effect effect = null; foreach (Effect e in effects) { if (e.type == type) { effect = e; } } return(effect); }
public IEnumerator PowerDown(Powerup.Type type) { yield return(new WaitForSeconds(5f)); switch (type) { case Powerup.Type.TripleShot: canTripleShot = false; break; case Powerup.Type.MaxShot: canMaxShot = false; break; case Powerup.Type.SpeedBoost: speed = 5f; break; } }
// Enable or disable an effect for a particular de/buff public void SetEffectActive(Powerup.Type type, bool setEnabled) { // select the first system of this type Debug.Log(type); Effect effect = GetEfect(type); if (effect == null) { return; } if (setEnabled) { if (effect.status != EffectStatus.ACTIVE) { activeEffectProps [effect.type] = Instantiate(effect.prop, transform); activeEffectProps [effect.type].transform.localPosition = propOffset; activeEffectProps [effect.type].transform.rotation = propRotation; } effect.status = EffectStatus.ACTIVE; if (effect.particles != null) { effect.particles.Play(); } } else { effect.status = EffectStatus.HIDDEN; GameObject g = activeEffectProps [effect.type]; activeEffectProps.Remove(effect.type); Destroy(g); if (effect.particles != null) { effect.particles.Stop(); } } }
public void PowerUp(Powerup.Type type) { switch (type) { case Powerup.Type.TripleShot: canTripleShot = true; break; case Powerup.Type.MaxShot: canMaxShot = true; break; case Powerup.Type.SpeedBoost: speed = 7.5f; break; case Powerup.Type.Shield: canShield = true; this.gameObject.transform.GetChild(0).gameObject.SetActive(canShield); break; } StartCoroutine(PowerDown(type)); }
public void ActivatePowerup(Powerup.Type type, Powerup.Target target, Player player) { List <Player> targets = new List <Player>(); //Decide who the powerup gets applied to if (target == Powerup.Target.SELF) //player passed as argument { targets = new List <Player>(); targets.Add(player); } else if (target == Powerup.Target.REST) //everyone except player as argument { targets = new List <Player>(GetComponent <GameManager>().players); targets.Remove(player); } //apply powerup to targers foreach (Player t in targets) { Buff b = CreateBuff(type, t); TogglePowerup(b, true); AddBuff(b); } }
public void setPowerupNotifyFlash(Powerup.Type type) { Effect effect = GetEfect(type); effect.status = EffectStatus.FLASHING; }