Exemple #1
0
 private void updatePlayerUI()
 {
     dstDisplay.text = "Distance to Ship: " +
                       Mathf.RoundToInt(Vector3.Distance(player.transform.position, ship.transform.position)) + "m";
     if (player.GetComponent <GravityBody>().referenceBody != null)
     {
         playerPlanetDisplay.text = "Currently Exploring: " + player.GetComponent <GravityBody>().referenceBody.getName();
     }
 }
Exemple #2
0
 public void Resume()
 {
     gameIsPaused = false;
     pauseMenuUI.SetActive(false);
     Time.timeScale = 1f;
     //firstPersonController.GetComponentInChildren<MouseLook>().enabled = true;
     firstPersonController.GetComponent <FirstPersonController>().enabled = true;
     firstPersonController.GetComponentInChildren <DoorDetectionLite>().CrosshairPrefabInstance.SetActive(true);
     Cursor.lockState = CursorLockMode.Locked;
     Cursor.visible   = false;
 }
    void ProximityCheck()
    {
        contactRight  = false;
        contactLeft   = false;
        contactTop    = false;
        contactBottom = false;
        contactFront  = false;
        contactBack   = false;

        RaycastHit hit;

        float contactDistance = contactOffset + 0.5f * fpc.GetComponent <CharacterController> ().height *transform.localScale.y;

        if (Physics.Raycast(transform.position, -transform.up, out hit, contactDistance, mask))
        {
            contactBottom = true;
        }

        if (Physics.Raycast(transform.position, transform.up, out hit, contactDistance, mask))
        {
            contactTop = true;
        }

        contactDistance = contactOffset + fpc.GetComponent <CharacterController> ().radius *transform.localScale.x;

        if (Physics.Raycast(transform.position, transform.forward, out hit, contactDistance, mask))
        {
            contactFront = true;
        }

        if (Physics.Raycast(transform.position, -transform.forward, out hit, contactDistance, mask))
        {
            contactBack = true;
        }

        contactDistance = contactOffset + fpc.GetComponent <CharacterController> ().radius *transform.localScale.x;

        if (Physics.Raycast(transform.position, -transform.right, out hit, contactDistance, mask))
        {
            contactLeft = true;
        }

        if (Physics.Raycast(transform.position, transform.right, out hit, contactDistance, mask))
        {
            contactRight = true;
        }

        if (contactRight && contactLeft)
        {
            fpc.isAlive = false;
        }
    }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     playerTransform  = player.GetComponent <Transform>();
     forwardTransform = forward.GetComponent <Transform>();
     theTransform     = GetComponent <Transform>();
     info             = FindObjectOfType <InfoManager>();
 }
Exemple #5
0
    IEnumerator Die()
    {
        controller.enabled = false;

        StartCoroutine(LerpAlpha(hurtScreen, 0.5f, 1f));

        Utils.PlayRandomAudio(audioSource, deathSounds);

        yield return(new WaitForSeconds(0.5f));

        StartCoroutine(LerpAlpha(hurtScreen, 0.5f, 1f));
        StartCoroutine(LerpAlpha(deathScreen, 0.5f, 1f));

        yield return(new WaitForSeconds(0.5f));

        controller.transform.position = checkpointPos;
        controller.GetComponent <FirstPersonController>().SetRot(checkpointRot);
        level.Reset(true);

        yield return(new WaitForSeconds(0.2f));

        controller.enabled = true;

        SetAlpha(hurtScreen, 0.0f);
        SetAlpha(deathScreen, 0.0f);
    }
Exemple #6
0
    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
    {
        LobbyPlayer           lobby     = lobbyPlayer.GetComponent <LobbyPlayer>();
        FirstPersonController spaceship = gamePlayer.GetComponent <FirstPersonController>();

        spaceship.name = lobby.name;
        spaceship.gameObject.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material.color = lobby.playerColor;
        if (spaceship.GetComponent <spawn> ().local)
        {
        }
    }
    void OnTriggerEnter(Collider other)
    {
        ControlPanelCam.enabled = true;
        FPCCam.enabled          = false;
        FPC.GetComponent <FirstPersonController>().enabled = false;
        OrbHUD.SetActive(false);
        pauseMenu.pauseMenuAccessible = false;

        CursorIsVisible = true;

        if (DnDMini.getGameComplete())
        {
            DnD_Incomplete.enabled = false;
            Sim.enabled            = true;
            Laser_Sim_Panel.SetActive(true);
        }
        else
        {
            DnD_Incomplete.enabled = true;
            Sim.enabled            = false;
        }
    }
            static bool Prefix(FirstPersonController __instance)
            {
                if (!_injectedNetworkStuff.NetworkManager.NetworkConnectionActive)
                {
                    return(true);
                }

                NetworkTransform transform = __instance.GetComponent <NetworkTransform>();

                var result = transform.isLocalPlayer;

                Utils.Log("[Debug] " + (result ? "" : "Not ") + " Allowing firstpersoncontroller to tick. (" + (transform.isClient ? "isClient " : "") + (transform.isServer ? "isServer ": "") + (transform.isLocalPlayer ? "isLocalPlayer" : "") + ") ID: " + transform.netId);
                return(result);
            }
Exemple #9
0
 // Start is called before the first frame update
 void Start()
 {
     jetpackAudio = GetComponent <AudioSource>();
     jetpackParticles.Stop();
     if (!flightTimeSlider.gameObject.activeSelf)
     {
         flightTimeSlider.gameObject.SetActive(true);
     }
     isFloating                = false;
     isFlying                  = false;
     currentFlightAccel        = flightAccel;
     currentFlightTime         = flightTime;
     sliderAnim                = flightTimeSlider.GetComponent <Animator>();
     playerFPController        = GetComponentInChildren <FirstPersonController>();
     playerCharController      = playerFPController.GetComponent <CharacterController>();
     flightTimeSlider.maxValue = flightTime;
 }
Exemple #10
0
    IEnumerator SendPlayerToStart()
    {
        playerController.enabled = false;

        PlayerDeath playerDeath = playerController.GetComponent <PlayerDeath>();
        Image       deathScreen = playerDeath.deathScreen;

        SetAlpha(deathScreen, 1.0f);

        yield return(new WaitForSeconds(0.1f));

        playerDeath.Reset();
        playerController.transform.position = playerDeath.GetStartPosition();

        yield return(new WaitForSeconds(0.1f));

        playerController.enabled = true;

        SetAlpha(deathScreen, 0.0f);
    }
    public void UpdateFadeIn()
    {
        if (!fadeInFinish)
        {
            alphaValue += Time.deltaTime * alphaValueSpeed;
            if (alphaValue >= 1)
            {
                startPanel.SetActive(false);
                player.GetComponent <FirstPersonController>().m_MouseLook.SetCursorLock(false);
                player.GetComponent <FirstPersonController>().enabled = false;
                alphaValue   = 1;
                fadeInFinish = true;
                finishPanel.SetActive(true);
            }

            canvas.alpha = alphaValue;
        }
    }
Exemple #12
0
    // public GameObject ScriptOnOff;
    //public GameObject FPSContoller;
    //public Animation Anim;



    private void Start()
    {
        Karacongolos.SetActive(false);
        FPSContoller.GetComponent <FirstPersonController>();
    }
Exemple #13
0
 void onCharacterPortalCollision()
 {
     startFading();
     FPSController.GetComponent <FirstPersonController>().enabled = false;
 }