示例#1
0
    /*
     * Revives the player from being ragdoll
     */
    public void Revive(Vector3 revivePosition)
    {
        isWaitingToStart = true;
        InitializeStatsOnRevive();

        // Restore ragdolled limbs
        PigmentBody body = (PigmentBody)playerGeo.GetComponent <PigmentBody> ();

        body.StartReviving();

        // Snap to revive position
        transform.position = revivePosition;

        isReviving = true;

        reviveTimeout = new RBTimer();
        reviveTimeout.StartTimer(2.0f);

        // Spawn the Revive FX at the Ragdoll's location.
        GameObject ragdollTorso = body.GetRagdollBody();
        Vector3    torsoXZ      = new Vector3(ragdollTorso.transform.position.x, 0.0f, ragdollTorso.transform.position.z);
        Vector3    fxPosition   = torsoXZ + new Vector3(0.0f, reviveFX.transform.position.y, reviveFX.transform.position.z);
        GameObject fx           = (GameObject)Instantiate(reviveFX, fxPosition, reviveFX.transform.rotation);

        fx.transform.parent = transform;
        Destroy(fx, 1.5f);
    }
示例#2
0
 /*
  * Use the ability associated with this power. This sets the cooldown timer
  * and the ability behavior itself is controlled by the player.
  */
 public void UseAbility()
 {
     if (IsPowerActive() && !abilityCooldownTimer.IsRunning())
     {
         abilityCooldownTimer.StartTimer(abilityCooldown);
         RemovePower(maxValue / abilityUsesPerMeter);
     }
 }
示例#3
0
    /*
     * Starts restoring back to normal gameplay after a boost
     */
    void StartBoostBraking()
    {
        isBoostBraking = true;
        boostFX.GetComponent <FX_Boost> ().StopEmitting();

        float BRAKE_TIME = 0.9f;

        boostBrakeTimer = new RBTimer();
        boostBrakeTimer.StartTimer(BRAKE_TIME);

        treadmill.StopBoostSpeed();
    }
示例#4
0
    /*
     * Begin using the boost consumable
     */
    void StartBoosting(bool isSuperBoost)
    {
        // Set state variables
        isBoosting     = true;
        isBoostBraking = false;

        treadmill.StartBoostSpeed();

        // Start the boost timer.
        boostTimer = new RBTimer();
        float BOOST_TIME = isSuperBoost ? 15.0f : 8.0f;

        boostTimer.StartTimer(BOOST_TIME);

        // Remove the inventory item if they had one
        if (isSuperBoost)
        {
            inventory.RemoveItem(ItemNames.SUPERBOOST);
        }
        else
        {
            inventory.RemoveItem(ItemNames.BOOST);
        }

        boostFX = (GameObject)Instantiate(boostFXPrefab, transform.position,
                                          transform.rotation);
        boostFX.transform.parent = transform;

        // Show Boost use Text
        GameObject fxPrefab = isSuperBoost ? superBoostTextFX : boostTextFX;
        GameObject fx       = (GameObject)Instantiate(fxPrefab, transform.position + fxPrefab.transform.position,
                                                      fxPrefab.transform.rotation);

        fx.transform.parent = transform;
        Destroy(fx, 1.5f);
    }
示例#5
0
    /*
     * Begin using the boost consumable
     */
    void StartBoosting(bool isSuperBoost)
    {
        // Set state variables
        isBoosting = true;
        isBoostBraking = false;

        treadmill.StartBoostSpeed ();

        // Start the boost timer.
        boostTimer = new RBTimer ();
        float BOOST_TIME = isSuperBoost ? 15.0f : 8.0f;
        boostTimer.StartTimer (BOOST_TIME);

        // Remove the inventory item if they had one
        if(isSuperBoost) {
            inventory.RemoveItem (ItemNames.SUPERBOOST);
        } else {
            inventory.RemoveItem (ItemNames.BOOST);
        }

        boostFX = (GameObject)Instantiate (boostFXPrefab, transform.position,
            transform.rotation);
        boostFX.transform.parent = transform;

        // Show Boost use Text
        GameObject fxPrefab = isSuperBoost ? superBoostTextFX : boostTextFX;
        GameObject fx = (GameObject)Instantiate (fxPrefab, transform.position + fxPrefab.transform.position,
            fxPrefab.transform.rotation);
        fx.transform.parent = transform;
        Destroy (fx, 1.5f);
    }
示例#6
0
    /*
     * Starts restoring back to normal gameplay after a boost
     */
    void StartBoostBraking()
    {
        isBoostBraking = true;
        boostFX.GetComponent<FX_Boost> ().StopEmitting ();

        float BRAKE_TIME = 0.9f;
        boostBrakeTimer = new RBTimer ();
        boostBrakeTimer.StartTimer (BRAKE_TIME);

        treadmill.StopBoostSpeed ();
    }
示例#7
0
    /*
     * Revives the player from being ragdoll
     */
    public void Revive(Vector3 revivePosition)
    {
        isWaitingToStart = true;
        InitializeStatsOnRevive ();

        // Restore ragdolled limbs
        PigmentBody body = (PigmentBody)playerGeo.GetComponent<PigmentBody> ();
        body.StartReviving ();

        // Snap to revive position
        transform.position = revivePosition;

        isReviving = true;

        reviveTimeout = new RBTimer ();
        reviveTimeout.StartTimer (2.0f);

        // Spawn the Revive FX at the Ragdoll's location.
        GameObject ragdollTorso = body.GetRagdollBody ();
        Vector3 torsoXZ = new Vector3( ragdollTorso.transform.position.x, 0.0f, ragdollTorso.transform.position.z);
        Vector3 fxPosition = torsoXZ + new Vector3(0.0f, reviveFX.transform.position.y, reviveFX.transform.position.z);
        GameObject fx = (GameObject)Instantiate (reviveFX, fxPosition, reviveFX.transform.rotation);
        fx.transform.parent = transform;
        Destroy (fx, 1.5f);
    }