Exemple #1
0
        void OnSpawned()
        {
            if (cam == null)
            {
                InitCamera();
            }

            is_spawned = true;

            cam.SetMainTarget(transform);
            cam.lockCamera   = false;
            cam.cutsceneMode = false;

            var bird = Main.self.bird;

            if (bird != null)
            {
                bird.SetActive(false);
            }

            if (is_player && hud != null)
            {
                is_freeze = true;
                hud.ShowStartTimer();
                StartCoroutine(Main.WaitAndDo(() => {
                    is_freeze = false;
                    abilites_queue.Clear();
                    ResetCooldowns();
                }, 3.0f));
            }
        }
Exemple #2
0
        protected virtual void UpdateCameraStates()
        {
            // CAMERA STATE - you can change the CameraState here, the bool means if you want lerp of not, make sure to use the same CameraState String that you named on TPCameraListData

            if (tpCamera == null)
            {
                tpCamera = FindObjectOfType <vThirdPersonCamera>();
                if (tpCamera == null)
                {
                    return;
                }
                if (tpCamera)
                {
                    tpCamera.SetMainTarget(this.transform);
                    tpCamera.Init();
                }
            }

            if (changeCameraState && !cc.isStrafing)
            {
                tpCamera.ChangeState(customCameraState, customlookAtPoint, smoothCameraState);
            }
            else if (cc.isCrouching)
            {
                tpCamera.ChangeState("Crouch", true);
            }
            else if (cc.isStrafing)
            {
                tpCamera.ChangeState("Strafing", true);
            }
            else
            {
                tpCamera.ChangeState("Default", true);
            }
        }
Exemple #3
0
        protected virtual void CharacterInit()
        {
            cc = GetComponent <vThirdPersonController>();
            if (cc != null)
            {
                cc.Init();
            }

            tpCamera = FindObjectOfType <vThirdPersonCamera>();
            if (tpCamera)
            {
                tpCamera.SetMainTarget(this.transform);
            }
        }
Exemple #4
0
 protected virtual void InitializeTpCamera()
 {
     if (tpCamera == null)
     {
         tpCamera = FindObjectOfType <vThirdPersonCamera>();
         if (tpCamera == null)
         {
             return;
         }
         if (tpCamera)
         {
             tpCamera.SetMainTarget(PlayerController.LocalPlayerInstance.transform);
         }
     }
 }
 protected virtual void InitializeTpCamera()
 {
     if (tpCamera == null)
     {
         tpCamera = FindObjectOfType <vThirdPersonCamera>();
         if (tpCamera == null)
         {
             return;
         }
         if (tpCamera)
         {
             tpCamera.SetMainTarget(this.transform);
             tpCamera.Init();
         }
     }
 }
        protected virtual void CharacterInit()
        {
            cc = GetComponent <vThirdPersonController>();
            if (cc != null)
            {
                cc.Init();
            }

            tpCamera = FindObjectOfType <vThirdPersonCamera>();
            if (tpCamera && !tpCamera.target)
            {
                tpCamera.SetMainTarget(this.transform);
            }
            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
        }
 protected virtual void UpdateCameraStates()
 {
     // CAMERA STATE - you can change the CameraState here, the bool means if you want lerp of not, make sure to use the same CameraState String that you named on TPCameraListData
     if (tpCamera == null)
     {
         tpCamera = FindObjectOfType <vThirdPersonCamera>();
         if (tpCamera == null)
         {
             return;
         }
         if (tpCamera)
         {
             tpCamera.SetMainTarget(this.transform);
             tpCamera.Init();
         }
     }
 }
        protected virtual void CharacterInit()
        {
            cc = GetComponent <vThirdPersonController>();
            if (cc != null)
            {
                cc.Init();
            }

            tpCamera = transform.parent.gameObject.GetComponentInChildren <vThirdPersonCamera>();
            if (tpCamera)
            {
                tpCamera.SetMainTarget(transform);
            }

            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
        }
Exemple #9
0
    public bool keepDirection;                          // keep the current direction in case you change the cameraState
    #endregion

    // Use this for initialization
    void Start()
    {
        controller   = GetComponent <PlayerController>();
        playercombat = GetComponent <PlayerCombat>();
        if (camera)
        {
            camera.SetMainTarget(this.transform);
        }

        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        if (controller != null)
        {
            controller.Init();
        }
    }
        protected virtual IEnumerator CharacterInit()
        {
            yield return(new WaitForEndOfFrame());

            if (tpCamera == null)
            {
                tpCamera = FindObjectOfType <vThirdPersonCamera>();
                if (tpCamera && tpCamera.target != transform)
                {
                    tpCamera.SetMainTarget(this.transform);
                }
            }
            if (hud == null && vHUDController.instance != null)
            {
                hud = vHUDController.instance;
                hud.Init(cc);
            }
        }
Exemple #11
0
    private void SetupAllPlayers(PlayerSpawnPoint[] spawnPoints)
    {
        int playerCount = 1;

        if (GameSparksManager.Instance())
        {
            playerCount = (int)GameSparksManager.Instance().GetSessionInfo().GetPlayerList().Count;
        }

        m_playerAvatarList = new Player[playerCount];

        Debug.Log("GC| Found " + m_playerAvatarList.Length + " Players...");

        // Loop through each player, and all spawn points, to assign each player to a spawn point based on the player's peerID
        for (int playerIndex = 0; playerIndex < playerCount; playerIndex++)
        {
            Debug.Log("GameController| playerIndex:" + playerIndex);
            for (int spawnerIndex = 0; spawnerIndex < spawnPoints.Length; spawnerIndex++)
            {
                Debug.Log("    GameController| Peer ID: " + GameSparksManager.Instance().GetSessionInfo().GetPlayerList()[playerIndex].peerID + " || SpawnID: " + spawnPoints[spawnerIndex].SpawnID);
                if (spawnPoints[spawnerIndex].SpawnID == GameSparksManager.Instance().GetSessionInfo().GetPlayerList()[playerIndex].peerID)
                {
                    GameObject newAvatar = Instantiate(PlayerAvatarPrefab, spawnPoints[spawnerIndex].gameObject.transform.position, spawnPoints[spawnerIndex].gameObject.transform.rotation) as GameObject;
                    newAvatar.name = GameSparksManager.Instance().GetSessionInfo().GetPlayerList()[playerIndex].peerID.ToString();

                    m_playerAvatarList[playerIndex] = newAvatar.GetComponent <Player>(); // add the new tank object to the corresponding reference in the list

                    if (GameSparksManager.Instance().GetSessionInfo().GetPlayerList()[playerIndex].peerID == GameSparksManager.Instance().GetRTSession().PeerId)
                    {
                        m_playerAvatarList[playerIndex].SetupPlayerAvatar(spawnPoints[spawnerIndex].gameObject.transform, true, Team.Blue); // @TODO - Setup HUD, setup player team to be read
                        ThirdPersonCamera.SetMainTarget(newAvatar.transform);
                    }
                    else
                    {
                        m_playerAvatarList[playerIndex].SetupPlayerAvatar(spawnPoints[spawnerIndex].gameObject.transform, false, Team.Red); // @TODO - Setup HUD, setup player team to be read
                    }

                    break;
                }
            }
        }
    }
Exemple #12
0
        protected virtual void CharacterInit()
        {
            if (cc != null)
            {
                cc.Init();
            }

            tpCamera = FindObjectOfType <vThirdPersonCamera>();
            if (tpCamera)
            {
                tpCamera.SetMainTarget(this.transform);
            }

            cursorPoint = transform.position;

            hud = vHUDController.instance;
            if (hud != null)
            {
                hud.Init(cc);
            }
        }
Exemple #13
0
    protected virtual void InitThirdPersonCharacter()
    {
        _thirdPersonController.Init();

        _tpCamera.SetMainTarget(this.transform);
    }