예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (pickupsComponent == null)
     {
         Spaceship ship = GameplayManager.spaceship;
         if (ship != null)
         {
             pickupsComponent = ship.GetComponent <SpaceshipPickups>();
         }
     }
     else
     {
         if (pickupsComponent.spaceship.equippedItem == EquipType.DEFAULT_WEAPON)
         {
             currentWeaponSprite.sprite2D = defaultLaser;
         }
         else if (pickupsComponent.currentPickup is PickupFlamethrower)
         {
             currentWeaponSprite.sprite2D = flamethrower;
         }
         else if (pickupsComponent.currentPickup is PickupMissiles)
         {
             currentWeaponSprite.sprite2D = missiles;
         }
         else if (pickupsComponent.currentPickup is PickupStickyMines)
         {
             currentWeaponSprite.sprite2D = stickyMines;
         }
         else
         {
             throw new Exception("HudCurrentWeapon(); Unrecognized pickup type: " + pickupsComponent.currentPickup);
         }
     }
 }
예제 #2
0
	// Update is called once per frame
	void Update () {

		if (pickupsComponent == null) {
			Spaceship ship = GameplayManager.spaceship;
			if (ship != null) {
				pickupsComponent = ship.GetComponent<SpaceshipPickups>();
			}
		}
		else {
			if (pickupsComponent.spaceship.equippedItem == EquipType.DEFAULT_WEAPON) {
				currentWeaponSprite.sprite2D = defaultLaser;
			}
			else if (pickupsComponent.currentPickup is PickupFlamethrower) {
				currentWeaponSprite.sprite2D = flamethrower;
			}
			else if (pickupsComponent.currentPickup is PickupMissiles) {
				currentWeaponSprite.sprite2D = missiles;
			}
			else if (pickupsComponent.currentPickup is PickupStickyMines) {
				currentWeaponSprite.sprite2D = stickyMines;
			}
			else {
				throw new Exception("HudCurrentWeapon(); Unrecognized pickup type: " + pickupsComponent.currentPickup);
			}
		}
	}
예제 #3
0
	// Update is called once per frame
	void Update () {

		if (gun == null || pickups == null) {
			Spaceship ship = GameplayManager.spaceship;
			if (ship != null) {
				gun = ship.gun;
				pickups = ship.pickups;
			}
		}
		else if (gun.enabled) {
			energybarSprite.color = defaultGunColor;
			currentScale.x = gun.currentEnergy/gun.maxEnergy * initialScale.x;	
		}
		else if (pickups.currentPickup != null) {
			if (pickups.currentPickup is PickupFlamethrower) {
				energybarSprite.color = flamethrowerColor;
				PickupFlamethrower auroraCannon = pickups.currentPickup as PickupFlamethrower;
				currentScale.x = auroraCannon.currentEnergy/auroraCannon.maxEnergy * initialScale.x;
			}
			else if (pickups.currentPickup is PickupMissiles) {
				energybarSprite.color = missilesColor;
				PickupMissiles missiles = pickups.currentPickup as PickupMissiles;
				currentScale.x = ((float)missiles.currentShots)/missiles.maxShots * initialScale.x;
			}
			else if (pickups.currentPickup is PickupStickyMines) {
				energybarSprite.color = stickyMinesColor;
				PickupStickyMines stickyMines = pickups.currentPickup as PickupStickyMines;
				currentScale.x = ((float)stickyMines.currentShots)/stickyMines.maxShots * initialScale.x;
			}
		}
		this.transform.localScale = currentScale;
	}
예제 #4
0
 // Update is called once per frame
 void Update()
 {
     if (gun == null || pickups == null)
     {
         Spaceship ship = GameplayManager.spaceship;
         if (ship != null)
         {
             gun     = ship.gun;
             pickups = ship.pickups;
         }
     }
     else if (gun.enabled)
     {
         energybarSprite.color = defaultGunColor;
         currentScale.x        = gun.currentEnergy / gun.maxEnergy * initialScale.x;
     }
     else if (pickups.currentPickup != null)
     {
         if (pickups.currentPickup is PickupFlamethrower)
         {
             energybarSprite.color = flamethrowerColor;
             PickupFlamethrower auroraCannon = pickups.currentPickup as PickupFlamethrower;
             currentScale.x = auroraCannon.currentEnergy / auroraCannon.maxEnergy * initialScale.x;
         }
         else if (pickups.currentPickup is PickupMissiles)
         {
             energybarSprite.color = missilesColor;
             PickupMissiles missiles = pickups.currentPickup as PickupMissiles;
             currentScale.x = ((float)missiles.currentShots) / missiles.maxShots * initialScale.x;
         }
         else if (pickups.currentPickup is PickupStickyMines)
         {
             energybarSprite.color = stickyMinesColor;
             PickupStickyMines stickyMines = pickups.currentPickup as PickupStickyMines;
             currentScale.x = ((float)stickyMines.currentShots) / stickyMines.maxShots * initialScale.x;
         }
     }
     this.transform.localScale = currentScale;
 }