Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        //on grabbing the flux, set fluxplayer to this player
        if (other.gameObject.CompareTag("Flux"))
        {
            gm.fluxPlayer = this;
            gm.ColorSwitch();
            gm.textFluxD1.text = "Spark: " + gm.fluxPlayer.ToString();
            gm.textFluxD2.text = "Spark: " + gm.fluxPlayer.ToString();
            gm.textFluxD3.text = "Spark: " + gm.fluxPlayer.ToString();
            gm.StartCoroutine("FluxColliderSeconds");
            Spectator._instance.SwitchCam(camera);
            StartCoroutine(Spectator._instance.LerpCamToPos(2));
            Destroy(other.gameObject);
            GetComponent <VirtualController>().SetVibration();

            audioObj.GetComponent <GeneralAudio>().SparkSound();
        }

        //on stepping on platform while holding flux, claim it
        if (other.gameObject.CompareTag("ColorPlatform") && gm.fluxPlayer == this)
        {
            PlatformState platform = other.gameObject.GetComponent <PlatformState>();

            if ((platform.GetPlayerID() != playerID) && (platform.GetIsChanging() == false))
            {
                platform.ChangeColorTo(playerID, playerColor);
                gm.updateScore();
                gm.SpeedPlayers();
                audioObj.GetComponent <GeneralAudio>().CheckPointSound();
            }
        }

        //single collision flux transfer + starting cooldown

        /*if (other.gameObject.CompareTag("FluxCollider" )){
         *              if(gm.fluxPlayer == other.gameObject.transform.parent.GetComponent<PlayerFlux>() && !gm.isFluxPlayerColliderOnCD){
         *                      Debug.Log("Parent Collision");
         *                      gm.fluxPlayer = this;
         *                      gm.textFluxPlayer.text = "Flux: " + gm.fluxPlayer.ToString();
         *                      gm.StartCoroutine("FluxColliderSeconds");
         *              }
         *              else{
         *                      return;
         *              }
         *      }*/
    }