Exemplo n.º 1
0
    void Start()
    {
        _motion   = Vector3.zero;
        _rotation = Vector3.zero;
        _pitch    = 0f;
        if (isLocalPlayer)
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            _sfx             = GetComponents <AudioSource>();
            g                = GetComponent <Grabber>();
            _camera          = Camera.allCameras[0].transform;
            _camera.position = transform.position - new Vector3(0, -7f, .5f);
            _camera.gameObject.GetComponent <Camera>().cullingMask &= ~(1 << LayerMask.NameToLayer("CameraInvisible"));
            _camera.SetParent(transform);
            _emitter = GetComponent <Splatter>();
            _emitter.SetEmitter(transform.GetChild(2).transform);
            _emitter.SetChannel(_splatChannel);
            //_body = GetComponent<Rigidbody>();
            _front = GetComponent <CharacterController>();
            TPMesh.SetActive(false);
            LeftArm.SetActive(true);
            RightArm.SetActive(true);

            /*_rightGrabRotation = RightArm.transform.localRotation;
             * _leftGrabRotation = LeftArm.transform.localRotation;
             * LeftArm.transform.Rotate(new Vector3(90, 0, 0));
             * RightArm.transform.Rotate(new Vector3(90, 0, 0));
             * _rightDownRotation = RightArm.transform.localRotation;
             * _leftDownRotation = LeftArm.transform.localRotation;
             */
            _animator = LeftArm.GetComponentInChildren <Animator>();
        }
    }
Exemplo n.º 2
0
        public override GameObject OnLobbyServerCreateGamePlayer(NetworkConnection conn, short playerControllerId)
        {
            int team = (int)currentPlayers[conn.connectionId];

            GameObject playerPrefab = (GameObject)GameObject.Instantiate(spawnPrefabs[team],
                                                                         startPositions[conn.connectionId].position,
                                                                         Quaternion.identity);

            Splatter s = playerPrefab.GetComponent <Splatter>();

            // set colors and channel mask (mask is implied by order)
            int            i            = 0;
            List <Vector4> DogColorList = new List <Vector4>();

            foreach (LobbyPlayer p in lobbyPlayers.Values)
            {
                if (p.playerTeam == Teams.Team.DOGS)
                {
                    DogColorList.Add(p.playerColor);
                    if (p.connectionId == conn.connectionId)
                    {
                        s.SetConnectionId(conn.connectionId);
                        if (i == 0)
                        {
                            s.SetChannel(SplatChannel.DOG0);
                        }
                        else if (i == 1)
                        {
                            s.SetChannel(SplatChannel.DOG1);
                        }
                        else if (i == 2)
                        {
                            s.SetChannel(SplatChannel.DOG2);
                        }
                    }
                    i++;
                }
            }
            s.SetColors(DogColorList);
            foreach (var d in DogColorList)
            {
                Debug.Log(d);
            }
            Debug.Log("Team " + 1 + " Prefab " + playerPrefab + " connId " + conn.connectionId);
            return(playerPrefab);
        }
Exemplo n.º 3
0
    void Start()
    {
        _frontPivot = transform.Find("frontPivot");
        _rearPivot  = transform.Find("rearPivot");
        FrontPeePoofs.transform.position = _frontPivot.transform.position;
        RearPeePoofs.transform.position  = _rearPivot.transform.position;
        _front          = GetComponent <Rigidbody>();
        _animator       = this.GetComponentInChildren <Animator>();
        _inputH         = GetComponent <InputHandler>();
        _sfx            = GetComponents <AudioSource>();
        _runStartVolume = _sfx [2].volume;
        d = GetComponent <Drinker>();

        if (isLocalPlayer)
        {
            _emitter = GetComponent <Splatter>();
            _emitter.SetEmitter(transform.Find("rearPivot"));
            _emitter.SetChannel(_splatChannel);
        }
    }
    void Start()
    {
        _pitch = 0f;
        if (isLocalPlayer)
        {
            _camera          = Camera.allCameras[0].transform;
            _camera.position = transform.position - new Vector3(0, -0.75f, .5f);
            _camera.gameObject.GetComponent <Camera>().cullingMask &= ~(1 << LayerMask.NameToLayer("CameraInvisible"));
            _camera.SetParent(transform);
            _emitter = GetComponent <Splatter>();
            _emitter.SetEmitter(transform);
            _emitter.SetChannel(_splatChannel);
            _front = GetComponent <CharacterController>();


            //BROCK'S ADDITION THAT ALLOWS FOR PREFAB ADJUSTMENTS
            GameObject ChildGameObject1 = transform.GetChild(0).gameObject;
            GameObject ChildGameObject2 = transform.GetChild(1).gameObject;
            ChildGameObject1.SetActive(false);
            ChildGameObject2.SetActive(true);
        }
    }