public void startWave() { startTime = Time.time; // Change color based on intensity Color col = Color.Lerp(worstColor, bestColor, intensity); GetComponent <Renderer>().material.color = col; renderColor = col; gameObject.SetActive(true); //generate the damaging particles, one for each building for (int i = 0; i < platforms.Length; i++) { Wave particle = (Wave)GameObject.Instantiate(damageParticle, transform.position, Quaternion.identity); particle.transform.SetParent(transform); particle.direction = (platforms[i].transform.position - transform.position).normalized; particle.speed = startSpeed; DamageParticleController dpg = particle.GetComponent <DamageParticleController>(); dpg.platformID = platforms[i].GetInstanceID(); //the cosineDegreeFactor is 1 if the direction of the damage particle is vertical (orthogonal to the ground) //and is 0 if the direction is horizontal dpg.cosineDegreeFactor = 1; // Mathf.Pow(particle.direction.y, 0.5f); dpg.distance = (platforms[i].transform.position - transform.position).magnitude; dpg.intensity = intensity; } }
public void bombAttack(Vector3 origin, int amount) { // TODO Clear bullets around bomb. GameObject particles = Instantiate(damageParticleSystem, origin, Quaternion.identity); DamageParticleController particleController = particles.GetComponent <DamageParticleController>(); particleController.setColor(Color.yellow); particleController.destination = bulletSpawnerObj.transform.position; particleController.travelTime = 0.75f; explode(origin, Color.yellow); explode(origin, new Color(1f, 0.5f, 0f)); damageBoss(amount); }
private void castHeal() { // TODO Visual fancy things to indicate fireball spell. foreach (CommandObjectController controller in magicControllers) { GameObject particles = Instantiate(damageParticleSystem, controller.transform.position, Quaternion.identity); DamageParticleController particleController = particles.GetComponent <DamageParticleController>(); particleController.setColor(Color.green); particleController.destination = warriorHpBarObj.transform.position; controller.despawn(); } healPlayer(40); }
private void castFireball() { // TODO Visual fancy things to indicate heal spell. foreach (CommandObjectController controller in magicControllers) { GameObject particles = Instantiate(damageParticleSystem, controller.transform.position, Quaternion.identity); DamageParticleController particleController = particles.GetComponent <DamageParticleController>(); particleController.setColor(Color.red); particleController.destination = bulletSpawnerObj.transform.position; controller.despawn(); } damageBoss(160); }
private IEnumerator criticalAttack(Vector3 origin, Vector3 destination) { GameObject particles = Instantiate(damageParticleSystem, origin, Quaternion.identity); particles.transform.localScale = new Vector3(5f, 5f, 5f); DamageParticleController controller = particles.GetComponent <DamageParticleController>(); controller.destination = bulletSpawnerObj.transform.position; controller.setColor(Color.red); yield return(new WaitForSeconds(0.1f)); particles = Instantiate(damageParticleSystem, origin, Quaternion.identity); particles.transform.localScale = new Vector3(2f, 2f, 2f); controller = particles.GetComponent <DamageParticleController>(); controller.destination = bulletSpawnerObj.transform.position; controller.setColor(new Color(1f, 0.5f, 0f)); yield return(new WaitForSeconds(0.1f)); particles = Instantiate(damageParticleSystem, origin, Quaternion.identity); controller = particles.GetComponent <DamageParticleController>(); controller.destination = bulletSpawnerObj.transform.position; controller.setColor(new Color(1f, 1f, 0f)); }