protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("Flags", true, out subEle); subEle.Value = MagicEffectFlags.ToString(); ele.TryPathTo("BaseCost", true, out subEle); subEle.Value = BaseCost.ToString("G15"); ele.TryPathTo("AssociatedItem", true, out subEle); AssociatedItem.WriteXML(subEle, master); ele.TryPathTo("MagicSchool", true, out subEle); subEle.Value = MagicSchool.ToString(); ele.TryPathTo("ResistanceType", true, out subEle); subEle.Value = ResistanceType.ToString(); ele.TryPathTo("Unknown", true, out subEle); subEle.Value = Unknown.ToString(); WriteUnusedXML(ele, master); ele.TryPathTo("Light", true, out subEle); Light.WriteXML(subEle, master); ele.TryPathTo("ProjectileSpeed", true, out subEle); subEle.Value = ProjectileSpeed.ToString("G15"); ele.TryPathTo("EffectShader", true, out subEle); EffectShader.WriteXML(subEle, master); ele.TryPathTo("ObjectDisplayShader", true, out subEle); ObjectDisplayShader.WriteXML(subEle, master); ele.TryPathTo("EffectSound", true, out subEle); EffectSound.WriteXML(subEle, master); ele.TryPathTo("BoltSound", true, out subEle); BoltSound.WriteXML(subEle, master); ele.TryPathTo("HitSound", true, out subEle); HitSound.WriteXML(subEle, master); ele.TryPathTo("AreaSound", true, out subEle); AreaSound.WriteXML(subEle, master); ele.TryPathTo("ConstantEffectEnchantmentFactor", true, out subEle); subEle.Value = ConstantEffectEnchantmentFactor.ToString("G15"); ele.TryPathTo("ConstantEffectBarterFactor", true, out subEle); subEle.Value = ConstantEffectBarterFactor.ToString("G15"); ele.TryPathTo("Archetype", true, out subEle); subEle.Value = Archetype.ToString(); ele.TryPathTo("ActorValue", true, out subEle); subEle.Value = ActorValue.ToString(); }
IEnumerator fanProjectile(int numProjectiles, float angularSpacing, GameObject target, ProjectileType pt = ProjectileType.Gravity, ProjectileSpeed ps = ProjectileSpeed.Fast, float degreeModifier = 0.0f) { if (numProjectiles < 1) { numProjectiles = 1; } float yv = -angularSpacing * 0.5f * (numProjectiles - 1); for (int i = 0; i < numProjectiles; ++i) { StartCoroutine(spit(target, pt, ps, yv + degreeModifier)); yv += angularSpacing; } // yield return null; // // Add sinusoidal xVel modifier // for(int i=0; i<numProjectiles; ++i) // { // temp[i].GetComponent<Projectile>().Configure(target, pt, ps, angularSpacing); // yv += angularSpacing; // } yield return(null); }
IEnumerator repeatProjectile(int numRepeats, float waitTime, GameObject target, ProjectileType pt = ProjectileType.Gravity, ProjectileSpeed ps = ProjectileSpeed.Fast, float degreeModifier = 0.0f) { attacking = true; float timer = waitTime; for (int i = 0; i < numRepeats; ++i) { while (timer < waitTime) { timer += Time.deltaTime; yield return(null); } timer = 0f; // Fire projectile GameObject temp = Instantiate(projectile, body[bodyLength - 1].transform.position, Quaternion.identity); yield return(null); yield return(null); temp.GetComponent <Projectile>().Configure(player, ProjectileType.Gravity, ProjectileSpeed.Fast, 0); } attacking = false; }
IEnumerator agasFireball(GameObject target, ProjectileType pt = ProjectileType.Linear, ProjectileSpeed ps = ProjectileSpeed.Fast, float degreeModifier = 3f) { attacking = true; GameObject temp = Instantiate(ghostball, agas.transform.position, Quaternion.identity); yield return(null); temp.GetComponent <Projectile>().Configure(target, pt, ps, degreeModifier); attacking = false; }
void Start() { speed = ProjectileSpeed.Slow; player = GameObject.Find("Player"); candleGlow = transform.GetChild(0); fire1 = transform.GetChild(1).GetChild(0).gameObject; fire2 = transform.GetChild(1).GetChild(1).gameObject; fire1Start = fire1.transform.position; fire2Start = fire2.transform.position; timer = 0f; currShots = 0; maxShots = 6; disableFire(); fireScaleRange = maxFireScale - minFireScale; }
public void setSpeed(int speed) { if (speed == 0) { this.speed = ProjectileSpeed.Slow; } else if (speed == 1) { this.speed = ProjectileSpeed.Med; } else { this.speed = ProjectileSpeed.Med; } }
IEnumerator spit(GameObject target, ProjectileType pt = ProjectileType.Gravity, ProjectileSpeed ps = ProjectileSpeed.Fast, float degreeModifier = 0.0f) { attacking = true; GameObject temp = Instantiate(projectile, body[bodyLength - 1].transform.position, Quaternion.identity); yield return(null); FMOD.Studio.EventInstance instance = FMODUnity.RuntimeManager.CreateInstance("event:/Enemy/E_Nhang/E_Nhang_AcidAttack"); instance.start(); temp.GetComponent <Projectile>().Configure(target, pt, ps, degreeModifier); attacking = false; }
public IEnumerable <Property> ToProperties() { // Add simple fields. var properties = new List <Property> { new Property(nameof(WorldSize), WorldSize.ToString(), comment: "The width and height of the game world."), new Property(nameof(MsPerFrame), MsPerFrame.ToString(), comment: "The number of milliseconds to spend per frame. FPS = 1000 / MsPerFrame."), new Property(nameof(FramesPerShot), FramesPerShot.ToString(), comment: "The number of frames to pause between each firing of a projectile."), new Property(nameof(RespawnRate), RespawnRate.ToString(), comment: "How many frames before a dead ship respawns."), new Property(nameof(ShipHitpoints), ShipHitpoints.ToString(), comment: "How many hitpoints ships should start with."), new Property(nameof(ProjectileSpeed), ProjectileSpeed.ToString(CultureInfo.InvariantCulture), comment: "How many units per frame that projectiles travel."), new Property(nameof(ShipEngineStrength), ShipEngineStrength.ToString(CultureInfo.InvariantCulture), comment: "How many units per frame that ships accellerate when thrusting."), new Property(nameof(ShipTurningRate), ShipTurningRate.ToString(CultureInfo.InvariantCulture), comment: "The degrees that a ship can rotate per frame."), new Property(nameof(ShipCollisionRadius), ShipCollisionRadius.ToString(CultureInfo.InvariantCulture), comment: "How close a projectile must get to collide with a ship."), new Property(nameof(StarCollisionRadius), StarCollisionRadius.ToString(CultureInfo.InvariantCulture), comment: "How close a projectile or ship must get to collide with a star."), new Property(nameof(ExplosiveGameMode), ExplosiveGameMode.ToString(), comment: "Set to true to enable the explosive game mode, where a large number of projectiles are spawned each time a sihp dies.") }; // Add all stars. foreach (var star in Stars) { properties.Add(new Property( nameof(Star), attributes: new Dictionary <string, string> { ["x"] = star.Location.GetX().ToString(CultureInfo.InvariantCulture), ["y"] = star.Location.GetY().ToString(CultureInfo.InvariantCulture), ["mass"] = star.Mass.ToString(CultureInfo.InvariantCulture) }, comment: "The location and mass of a star." )); } return(properties); }
IEnumerator repeatFanProjectile(int numRepeats, float waitTime, int numProjectiles, float angularSpacing, GameObject target, ProjectileType pt = ProjectileType.Linear, ProjectileSpeed ps = ProjectileSpeed.Med, float degreeModifier = 0.0f) { if (numProjectiles < 1) { numProjectiles = 1; } attacking = true; float timer = waitTime; for (int r = 0; r < numRepeats; ++r) { while (timer < waitTime) { timer += Time.deltaTime; yield return(null); } timer = 0f; // Fire projectile float yv = -angularSpacing * 0.5f * (numProjectiles - 1); GameObject[] temp = new GameObject[numProjectiles]; for (int i = 0; i < numProjectiles; ++i) { temp[i] = Instantiate(projectile, body[bodyLength - 1].transform.position, Quaternion.identity); } yield return(null); // Add sinusoidal xVel modifier for (int i = 0; i < numProjectiles; ++i) { temp[i].GetComponent <Projectile>().Configure(target, pt, ps, yv + degreeModifier); yv += angularSpacing; } } attacking = false; yield return(null); }
IEnumerator fanSpray(int numRepeats, float waitTime, int numProjectiles, float angularSpacing, GameObject target, ProjectileType pt = ProjectileType.Linear, ProjectileSpeed ps = ProjectileSpeed.Med, float degreeModifier = 0.0f) { attacking = true; float timer = 0.0f; float halfway = (numProjectiles - 1) / 2f; for (int repeat = 0; repeat < numRepeats; ++repeat) { for (int p = 0; p < numProjectiles; ++p) { StartCoroutine(spit(target, pt, ps, (p - halfway) * angularSpacing + degreeModifier)); while (timer < waitTime) { timer += Time.deltaTime; yield return(null); } timer = 0f; } } attacking = false; }
public void Configure(GameObject target, ProjectileType pt, ProjectileSpeed ps, float degreeModifier, float?presetAngle = null) { float a = target.transform.position.x - transform.position.x; float b = target.transform.position.y - transform.position.y; float angle = Mathf.Atan2(b, a) + degreeModifier * Mathf.Deg2Rad; if (presetAngle != null) { angle = presetAngle.Value * Mathf.Deg2Rad; } angle = PosMod(angle); Quaternion newRotation = new Quaternion(); newRotation.eulerAngles = new Vector3(0, 0, angle * Mathf.Rad2Deg + 90); transform.rotation = newRotation; float v; switch (ps) { case ProjectileSpeed.Stop: v = 0f; break; case ProjectileSpeed.Slow: v = SLOW_VEL; break; case ProjectileSpeed.Med: v = MED_VEL; break; case ProjectileSpeed.Fast: v = FAST_VEL; break; case ProjectileSpeed.Faster: v = FASTER_VEL; break; default: v = MED_VEL; break; } a = Mathf.Cos(angle) * v; b = Mathf.Sin(angle) * v; rb.velocity = new Vector2(a, b); switch (pt) { case ProjectileType.Gravity: break; default: rb.gravityScale = 0f; break; } }