예제 #1
0
파일: Health.cs 프로젝트: psturmfels/Axis
 void Start()
 {
     damagedClip = Resources.Load("Damaged") as AudioClip;
     dfob        = GetComponent <DisplayFloatOnBar> ();
     dfob.SetDispValue(currentHealth, displayHealthIndex);
     dfob.SetDispValue(currentHealth, displayMiniHealthIndex);
 }
예제 #2
0
파일: Health.cs 프로젝트: psturmfels/Axis
 void Update()
 {
     if (shouldRegenerate)
     {
         currentHealth = Mathf.Min(currentHealth + regenerateRate * Time.timeScale, 1.0f);
     }
     dfob.SetDispValue(currentHealth, displayHealthIndex);
     dfob.SetDispValue(currentHealth, displayMiniHealthIndex);
 }
예제 #3
0
 void FixedUpdate()
 {
     if (isDashing)
     {
         if (dashRemaining <= 0.0f)
         {
             EndDash();
             return;
         }
         Instantiate(shipResidual, transform.position, transform.rotation);
         Vector3 dashDirection = transform.up.normalized * dashIncrement;
         transform.position = transform.position + dashDirection;
         dashRemaining      = Mathf.Max(dashRemaining - dashConsumptionRate, 0.0f);
         dfob.SetDispValue(dashRemaining, warpIndex);
     }
 }
예제 #4
0
 // Update is called once per frame
 void Update()
 {
     if (im.GetInputEnabled() && Input.GetKeyDown(spawnKey))
     {
         if (canSpawn && currentSpawnedShip == null && spawnMeterRemaining == spawnMeterMax)
         {
             SpawnProjection();
             spawnMeterRemaining = 0.0f;
         }
         else if (currentSpawnedShip != null)
         {
             TeleportToProjection();
         }
         else
         {
             AudioSource.PlayClipAtPoint(errorClip, Vector3.back * 500.0f, 0.4f);
             dfob.ErrorAtIndex(spawnMeterIndex);
         }
     }
     else
     {
         if (spawnMeterRemaining < 1.0f && spawnMeterRemaining + spawnMeterRegenRate >= 1.0f)
         {
             AudioSource.PlayClipAtPoint(ready, Vector3.back * 500.0f, 0.35f);
         }
         spawnMeterRemaining = Mathf.Min(spawnMeterMax, spawnMeterRemaining + spawnMeterRegenRate * Time.timeScale);
         dfob.SetDispValue(spawnMeterRemaining, spawnMeterIndex);
     }
 }