public void OnObjectHit(GameObject other) { //Destroy(other); PlayerTurret player = other.GetComponent <PlayerTurret>(); LaserBolt laser = other.GetComponent <LaserBolt>(); if (player != null) { GameController.instance.GameOver(); Instantiate(Resources.Load(ParticleLibrary.enemyExplosion), transform.position, transform.rotation); Destroy(gameObject); } else if (laser != null) { if (laser.type == LaserBolt.FriendOrFoe.Friendly && !healthScript.bIsDead) { if (healthScript.TakeDamage(laser.powerLevel)) { Instantiate(Resources.Load(ParticleLibrary.enemyExplosion), transform.position, transform.rotation); // Done in laser class //Value script = GetComponent<Value>(); //ExpController.instance.GainExperience(script.ExpValue); Destroy(gameObject); } else { // Play hit sound } } } }
public Player(IngameState game) { this.game = game; wheels = new PlayerWheels(); chassis = new PlayerChassis(); turretLeft = new PlayerTurretInaccurate(); turretRight = new PlayerTurretSpread(); this.healthbar = new Healthbar(chassis.graphic); }
public void ChangeLight() // Take input from the Light Slider (0 to 1) and adjust spotlight range and intensity and point light intensity { float input = lightSlider.value; playerSpotLight.range = 6 + (9 * input); // We found a spotlight range from 6 to 15 reasonable, so that's where the numbers come from playerSpotLight.intensity = 4 - (2 * input); // We found a spotlight intensity from 4 to 2 resonable playerPointLight.intensity = 2 + (2 * input); // We found a pointlight intensity from 2 to 4 reasonable playerDetectionZone.radius = 5 + (5 * input); // Increase player detection area with light level; probably need a seperate function in the future to compound light level with time spent mining lightsEnergyCostPerSecond = 0 + (2 * input); for (int i = 0; i < turrets.Length; i++) { PlayerTurret turretScript = turrets[i].GetComponent <PlayerTurret>(); turretScript.fireBubbleDistance = 2.5f + (2 * input); turretScript.fireBubbleRadius = 3 + (2 * input); } }
public override void ModifyStats(TheTransmission player) { turret = new PlayerTurret(player, new Vector2(0, -3)); }