Beispiel #1
0
 /// <summary>
 /// Fills the health of the gunner.
 /// </summary>
 public void purchaseHealth()
 {
     if (rm.getEnergy() >= healthCost && playerHealth.getHealth() != playerHealth.maxHealth)
     {
         rm.useEnergy(healthCost);
         playerHealth.heal(playerHealth.maxHealth);
     }
 }
Beispiel #2
0
    void setShield()
    {
        if (shieldHealth == null)
        {
            shieldBar.localScale =
                new Vector3(1f, magic.shieldManager.currentHealth / magic.shieldManager.maxHealth, 1f);
            return;
        }

        if (shieldHealth.maxHealth != 0)
        {
            shieldBar.localScale = new Vector3(1f, shieldHealth.getHealth() / shieldHealth.maxHealth, 1f);
        }
    }
Beispiel #3
0
    void FixedUpdate()
    {
        Vector3 forward = getFoward();

        if (!forward.Equals(Vector3.zero) && !transform.position.Equals(Vector3.zero))
        {
            transform.rotation = Quaternion.LookRotation(forward, -grav.getDownDir());
        }

        doMovement();
        doRotations();

        if (transform.position.magnitude > MapManager.mapSize * 3.5f && MapManager.manager != null &&
            MapManager.manager.mapDoneLocally) //if you fall out come back in
        {
            //transform.position = new Vector3(0, -10, 0);
            player.spawnOnMap();
            rb.velocity = Vector3.zero;
        }

        if (grav == null)
        {
            grav = GetComponent <Gravity>();
        }

        if (health == null)
        {
            health = GetComponent <NetHealth>();
        }

        // TODO this shouldn't be here
        if (grav != null && !grav.inSphere && health != null && health.getHealth() > 0 && MapManager.manager != null &&
            MapManager.manager.mapDoneLocally && TeamManager.singleton != null && !TeamManager.localPlayer.spawned)
        {
            //should be in sphere but isnt
            if (GameEventManager.clockTime > 250)
            {
                //enough time has passed that the origonal spawning must have failed
                Debug.LogError("having to respawn players manually after 250 seconds from game start");
                BuildLog.writeLog("having to respawn players manually after 250 seconds from game start");

                grav.inSphere = true;
                TeamManager.singleton.CmdSpawnAllPlayers();
            }
        }
    }