Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (this.isLocalPlayer)
        {
            ThirdPersonCamera camera = FindObjectOfType <ThirdPersonCamera>();

            // Setting bunny offset target if BunnyController exists
            BunnyController bunnyContr = GetComponent <BunnyController>();

            if (camera != null)
            {
                if (!bunnyContr)
                {
                    camera.SetTarget(this.transform);
                }
                else
                {
                    camera.SetTarget(this.transform.GetChild(2));
                }
            }
            this.tag = "Player";
            transform.GetChild(0).gameObject.SetActive(true);
        }
        else
        {
            this.tag = "Enemy";
        }
    }
Exemplo n.º 2
0
 public void ResetRagdoll()
 {
     tpCamera.offSetPlayerPivot = offSetPivot;
     tpCamera.SetTarget(this.transform);
     lockPlayer       = false;
     verticalVelocity = 0f;
     ragdolled        = false;
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        stateMachine = new StateMachine();

        if (CameraObj != null)
        {
            camController = CameraObj.GetComponent <ThirdPersonCamera>();
        }
        else
        {
            camController = Camera.main.GetComponent <ThirdPersonCamera>();
        }

        camController.SetTarget(Ref_CamDefault.transform);
        camController.SetTargetCameraPos(defCamDist, defOffset);
        //camController.camTargetRef = Ref_CamDefault.transform;
        //camController.camAimingTargetRef = Ref_CamAiming.transform;

        probeController = Probe.GetComponent <ProbeBehavior>();
        charController  = GetComponent <CharacterController>();
        animator        = GetComponent <Animator>();
        dogBehaviour    = AIDogo.GetComponent <DogBehavior>();
        pickupBehaviour = ThrowingDogo.GetComponent <PickupBehavior>();
        Sound_bark      = GetComponent <AudioSource>();


        // Give stateMachine a state so that coroutine StateSwitch has something
        // to compare with
        stateMachine.ChangeState(new DefaultPlayer(this, animator));

        StartCoroutine(StateSwitch(stateMachine));
        StartCoroutine(DogSwitcher());

        Cursor.lockState = CursorLockMode.Locked;
    }
Exemplo n.º 4
0
 // Switch what player you're following
 // index: index of the player to view
 private void switchPlayerView(int index)
 {
     _currentPlayerIdx = (index + _players.Count) % _players.Count;
     updatePlayers();
     transform.localPosition    = new Vector3(0, 0, 0);
     _thirdPersonCamera.enabled = true;
     _thirdPersonCamera.SetTarget(_players[_currentPlayerIdx].transform);
     _ui.followingPlayerChange(_players[_currentPlayerIdx].GetComponent <PlayerInformation>().playerName);
 }
Exemplo n.º 5
0
        public void ButtonPlay_Click()
        {
            switch (vehicleDropdown.value)
            {
            case 0:
                driver.SetVehicleController(car);
                thirdPersonCamera.SetTarget(car.transform);
                break;

            case 1:
                driver.SetVehicleController(bike);
                thirdPersonCamera.SetTarget(bike.transform);
                break;
            }

            // Close ui
            gameObject.SetActive(false);
        }
Exemplo n.º 6
0
        void SetupPlayerCharacter(Model.Entity.PlayerCharacter data)
        {
            Vector3 pos    = new Vector3(-4.0f, 0.0f, 0.0f);
            var     prefab = (GameObject)Resources.Load("Prefabs/Player/" + data.Resource);
            var     obj    = Instantiate(prefab, pos, Quaternion.identity);

            playerCharacter = obj.GetComponent <PlayerCharacter>();
            playerCharacter.SetParameter(data);
            mainCamera.SetTarget(playerCharacter.gameObject);
            playerCharacter.SetThirdPersonCamera(mainCamera);
            playerCharacter.InitCommonMotion();
        }
Exemplo n.º 7
0
        void Start()
        {
            mainCamera.SetTarget(playerObject);

            panelTitleObject.SetActive(true);
            panelSelectObject.SetActive(false);
            panelStartObject.SetActive(false);

            // startボタンイベント
            startButton.onClick.AsObservable().Subscribe(_ => SetPanelSelect());

            // PlayerCharacter選択ボタンイベント
            foreach (var charaButton in characterButtons)
            {
                charaButton.IdEvent.Subscribe(id => {
                    idSubject.OnNext(id);
                    SetStartPanel();
                });
            }

            // 最終確認ボタン
            confirmYesButton.onClick.AsObservable().Subscribe(_ => startBattleSubject.OnNext(Unit.Default));
            confirmNoButton.onClick.AsObservable().Subscribe(_ => SetPanelSelect());
        }