Exemple #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);
    }
Exemple #2
0
    /*
     * Called when the ragdoll is done bringing the body parts back together.
     */
    public void OnBodyRevived()
    {
        reviveTimeout.StopTimer();
        isReviving       = false;
        IsDead           = false;
        collider.enabled = true;

        PigmentBody body = (PigmentBody)playerGeo.GetComponent <PigmentBody> ();

        body.RestoreBody();

        DoBlockClearExplosion();

        GameManager.Instance.OnReviveDone();
    }
Exemple #3
0
    /*
     * Spawns the player at the specified position
     */
    public void Spawn(Vector3 spawnPosition)
    {
        isWaitingToStart = true;
        IsDead           = false;
        collider.enabled = true;

        PigmentBody body = (PigmentBody)playerGeo.GetComponent <PigmentBody> ();

        body.RestoreBody();
        body.SetColor(ColorWheel.neutral);

        InitializeStatsOnSpawn();

        // Snap to spawn position
        transform.position = spawnPosition;
    }
Exemple #4
0
    /*
     * Kill the player
     */
    public void Die()
    {
        IsDead           = true;
        collider.enabled = false;

        // Change the background to neutral
        ChangeColors(ColorWheel.neutral);
        redPower.ResetPower();
        greenPower.ResetPower();
        bluePower.ResetPower();

        GameManager.Instance.EndRun();
        audio.PlayOneShot(deathSound);
        PigmentBody body = (PigmentBody)playerGeo.GetComponent <PigmentBody> ();

        body.ReplaceWithRagdoll();

        // pause running animation
        playerGeo.animation["pigment_run"].speed = 0.0f;
    }
Exemple #5
0
    /*
     * Refresh the current color on the character
     */
    void RenderCurrentColor()
    {
        PigmentBody body = (PigmentBody)playerGeo.GetComponent <PigmentBody> ();

        body.SetColor(playerRGB.color);
    }