Beispiel #1
0
    // Called each frame, ensures balance gets shifted after BALANCE_SHIFT_TIME
    private void UpdateBalance()
    {
        AddToBalance(((int)currentBalanceDirection) * roomPresenceImpact);

        if (currentRoom != PlayerLocation.CENTRAL_ROOM)
        {
            // Always shift the balance to negative after BALANCE_SHIFT_TIME time
            if (timeUntilBalanceShift > 0.0f)
            {
                timeUntilBalanceShift -= Time.deltaTime;
            }
            else
            {
                // Shift the balance to negative
                currentBalanceDirection = BalanceDirection.DRAINING_FACTOR;
                timeUntilBalanceShift   = BALANCE_SHIFT_TIME;
                Debug.Log("Balance Shifted");
            }
        }
        else
        if (currentRoom == PlayerLocation.CENTRAL_ROOM)
        {
            if (shiftedSinceAction)
            {
                // Only shift balance if we haven't already shifted it
                return;
            }

            // Balance shift after some time
            if (timeUntilBalanceShift > 0.0f)
            {
                timeUntilBalanceShift -= Time.deltaTime;
            }
            else
            {
                // Shift the balance
                if (currentBalanceDirection == BalanceDirection.DRAINING_FACTOR)
                {
                    currentBalanceDirection = BalanceDirection.RECHARGE_FACTOR;
                }
                else
                {
                    currentBalanceDirection = BalanceDirection.DRAINING_FACTOR;
                }
                timeUntilBalanceShift = BALANCE_SHIFT_TIME;
                Debug.Log("Balance Shifted");
                shiftedSinceAction = true;
            }
        }
    }
Beispiel #2
0
    private void GainPositiveExperience()
    {
        if (trailController.TrailLength() >= maxTrailLength)
        {
            // Only allow experiences to impact balance up until a certain point
            return;
        }

        currentBalanceDirection = BalanceDirection.RECHARGE_FACTOR;
        AddToBalance(experienceImpact);
        cameraController.UpdatePlayerVision(currentBalanceDirection, experienceImpact);
        //if (!experienceCollectAudioSource.isPlaying)
        //experienceCollectAudioSource.Play();
        trailController.GrowTrail();
    }
Beispiel #3
0
    private void MoveToRoom(PlayerLocation newRoom)
    {
        if (newRoom == currentRoom)
        {
            return;
        }
        PlayerController otherPlayerController = otherPlayer.GetComponent <PlayerController>();

        currentRoom       = newRoom;
        touchedSinceEntry = false;
        otherPlayerController.touchedSinceEntry = false;
        //Debug.Log(playerNumber + " moved to room " + currentRoom.ToString());

        if (currentRoom != PlayerLocation.CENTRAL_ROOM)
        {
            // Recharge when entering a room
            currentBalanceDirection = BalanceDirection.RECHARGE_FACTOR;
            timeUntilBalanceShift   = BALANCE_SHIFT_TIME;
            shiftedSinceAction      = false;
            EnableDarkVignette();               // Increased vignette effect when in another room
            otherPlayerController.EnableDarkVignette();

            if (currentRoom == PlayerLocation.ROOM1)
            {
                room1ExperienceSpawner.ResetSpawnDelay();
            }
            if (currentRoom == PlayerLocation.ROOM2)
            {
                room2ExperienceSpawner.ResetSpawnDelay();
            }
            if (currentRoom == PlayerLocation.ROOM3)
            {
                room3ExperienceSpawner.ResetSpawnDelay();
            }
        }
        else
        if (otherPlayerController.GetLocation() == PlayerLocation.CENTRAL_ROOM)
        {
            DisableAloneVignette();             // Don't use increased vignette effect in central room
            otherPlayerController.DisableAloneVignette();
        }
    }
Beispiel #4
0
    /*********************************************************************************************************
     *                                                                                      PUBLIC FUNCTIONS
     **********************************************************************************************************/

    public void OnCloseToOtherPlayer()
    {
        this.isCloseToOtherPlayer = true;

        // Flash effect
        cameraController.FlashEffect();

        // Reunite effect
        if (!touchedSinceEntry)
        {
            touchedSinceEntry = true;
            //Debug.Log(playerNumber + " reunites");
            cameraController.AddPlayerVisionImpulse(otherPlayerImpact);
            AddToBalance(otherPlayerImpact);
            currentBalanceDirection = BalanceDirection.RECHARGE_FACTOR;
            timeUntilBalanceShift   = BALANCE_SHIFT_TIME;
            shiftedSinceAction      = false;
            reuniting = true;
            soundController.PlayReuniteSound();
        }
    }
Beispiel #5
0
    void Start()
    {
        // Set player-specific variables
        if (playerNumber == Player.PLAYER_ONE)
        {
            axisH              = "P1_Horizontal";
            axisV              = "P1_Vertical";
            magnetButton       = "P1_MagnetButton";
            magnetButtonOther  = "P2_MagnetButton";
            magnetTrigger      = "P1_MagnetTrigger";
            magnetTriggerOther = "P2_MagnetTrigger";
            spriteController.SetColor(colorPlayer1);
        }
        else
        {
            axisH              = "P2_Horizontal";
            axisV              = "P2_Vertical";
            magnetButton       = "P2_MagnetButton";
            magnetButtonOther  = "P1_MagnetButton";
            magnetTrigger      = "P2_MagnetTrigger";
            magnetTriggerOther = "P1_MagnetTrigger";
            spriteController.SetColor(colorPlayer2);
        }

        // Set visualisation variables
        emission                         = aura.emission;
        emissionRateOverTime             = aura.emission.rateOverTime;
        maxAuraEmissionRate              = emission.rateOverTime.constantMax;
        emissionRateOverTime.constantMax = 0.0f;
        emissionRateOverTime.constantMin = 0.0f;
        emissionRateOverTime.constant    = 0.0f;
        emission.rateOverTime            = emissionRateOverTime;
        emission                         = emission;

        // Setup emotional balance
        currentBalanceDirection = BalanceDirection.RECHARGE_FACTOR;
        timeUntilBalanceShift   = BALANCE_SHIFT_TIME;
        currentSpeed            = neutralSpeed;
        spriteController.SetBounds(balanceMaxBound);
    }
Beispiel #6
0
 private void StopImpulse()
 {
     cameraController.StopImpulse();
     reuniting = false;
     currentBalanceDirection = BalanceDirection.DRAINING_FACTOR;
 }