Inheritance: UnityEngine.MonoBehaviour
Esempio n. 1
0
    void FixedUpdate()
    {
        GameObject thePlayer = GameObject.FindWithTag("Player");

        UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl playerScript = thePlayer.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();

        if (playerScript.aim)
        {
            if (Input.GetKey(KeyCode.Mouse0) && counter > delayTime && ammo > 0)
            {
                mousePos = Input.mousePosition;
                transform.LookAt(Camera.main.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, zDistance)));
                Instantiate(bullet, transform.position, transform.rotation);
                GetComponent <AudioSource>().Play();
                counter = 0;

                RaycastHit hit;
                Ray        ray = new Ray(transform.position, transform.forward);
                if (Physics.Raycast(ray, out hit, zDistance))
                {
                    //Instantiate(bulletHole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
                }
            }
            counter += Time.deltaTime;
        }
    }
Esempio n. 2
0
 private void Awake()
 {
     Instance           = this;
     headPosition       = cameraController.lookAt;
     movementController = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
     animator           = GetComponent <Animator>();
     capsuleCollider    = GetComponent <CapsuleCollider>();
 }
Esempio n. 3
0
    //-----------------------------------------------------
    void Awake()
    {
        GameObject player1GO = GameObject.FindWithTag("player");
        GameObject player2GO = GameObject.FindWithTag("player2");

        control  = player1GO.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
        control2 = player2GO.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
    }
    //-----------------------------------------------------
    void Awake()
    {
        GameObject player1GO = GameObject.FindWithTag ("player");
        GameObject player2GO = GameObject.FindWithTag ("player2");

        control = player1GO.GetComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
        control2 = player2GO.GetComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     user                  = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
     ai                    = GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>();
     character             = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
     crazy                 = false;
     checkingForNotMoveing = false;
     forceIn               = false;
 }
 // Use this for initialization
 void Start()
 {
     player            = GameObject.FindGameObjectWithTag(("Player"));
     tpuc              = player.GetComponent <ThirdPersonUserControl>();
     distance          = 10;
     startDisplacement = transform.position - player.transform.position;
     initFOV           = this.GetComponent <Camera>().fieldOfView;
     toPlayer          = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2 + 50, 0));
 }
 public void JumpCharacter()
 {
     UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl thirdPerson = gameObject.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
     if (thirdPerson != null)
     {
         Debug.Log("skokkk");
         thirdPerson.JumpCharacter();
     }
 }
 public void TurnRightCharacter()
 {
     UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl thirdPerson = gameObject.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
     if (thirdPerson != null)
     {
         Debug.Log("prawooo");
         thirdPerson.TurnRight();
     }
 }
Esempio n. 9
0
 private void Start()
 {
     player     = GameObject.FindGameObjectWithTag("Player");
     boat       = GameObject.FindGameObjectWithTag("Boat");
     front      = transform.Find("BoatFront");
     back       = transform.Find("BoatBack");
     tpuc       = player.GetComponent <ThirdPersonUserControl>();
     seatParent = transform.Find("boat");
     seat       = seatParent.gameObject.transform.Find("BoatSeat");
 }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        AreaTrans = InventoryUIArea.GetComponent <RectTransform>();
        //DropZone = GameObject.Find ("AcceptableDropZone");
        //DZB = DropZone.GetComponent<BRS_DropZoneBehavior> ();
        ThirdPersonAnimator = TPC.GetComponent <Animator>();
        PlayerControlScript = TPC.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();

        SlotCenters = InventoryUIArea.GetComponentsInChildren <Transform>();
    }
Esempio n. 11
0
        void Start()
        {
            m_Animator      = GetComponent <Animator>();
            m_Rigidbody     = GetComponent <Rigidbody>();
            m_Capsule       = GetComponent <CapsuleCollider>();
            m_UserControl   = GetComponent <ThirdPersonUserControl>();
            m_CapsuleHeight = m_Capsule.height;
            m_CapsuleCenter = m_Capsule.center;

            m_Rigidbody.constraints   = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
            m_OrigGroundCheckDistance = m_GroundCheckDistance;
        }
Esempio n. 12
0
        private void Start()
        {
            deathWait         = false;
            deathText.enabled = false;
            deathWaitSec      = 4;
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent     = GetComponentInChildren <NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;
            distance             = 1.0f;
            agent            = GetComponent <NavMeshAgent>();
            player           = GameObject.FindGameObjectWithTag("Player");
            playerController = player.GetComponent <ThirdPersonUserControl>();
        }
Esempio n. 13
0
    // Start is called before the first frame update
    void Start()
    {
        terminalActive = false;
        bm             = FindObjectOfType <ButtonManager>();
        rb             = GetComponentInParent <Rigidbody>();
        tpc            = GetComponentInParent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
        tpuc           = GetComponentInParent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
        parent         = GameObject.FindGameObjectWithTag("Player");
        gm             = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        //iZone = GetComponentInChildren<BoxCollider>();
        a = gameObject.AddComponent <AudioSource>();
        //smr = GetComponentInParent<SkinnedMeshRenderer>();


        interactText         = GameObject.FindGameObjectWithTag("InteractUI").GetComponent <Text>();
        interactText.enabled = false;
        //iZone.enabled = true;
    }
        private void Start()
        {
            PV          = GetComponent <PhotonView>();
            m_character = GetComponent <ThirdPersonCharacter>();
            m_control   = GetComponent <ThirdPersonUserControl>();
            GMS         = GetComponentInChildren <GameModeSystem>();


            if (PV.IsMine)
            {
                Interface_UI_3.SetActive(true);
                PhotonID_User = PV.ViewID;
                PV.RPC("SetName", RpcTarget.All);
            }
            else
            {
                GMS.enabled = false;
            }
        }
Esempio n. 15
0
 public void SetPlayer(ThirdPersonUserControl tpuc)
 {
     player = tpuc;
 }
Esempio n. 16
0
 // Use this for initialization
 void Start()
 {
     Player = GameObject.FindGameObjectWithTag("Player");
     //PlayerController = Player.GetComponent<ThirdPersonUserControl> ();
     Script = Player.GetComponent <ThirdPersonUserControl> ();
 }
Esempio n. 17
0
        void Start()
        {
            m_Animator = GetComponent<Animator>();
            m_Rigidbody = GetComponent<Rigidbody>();
            m_Capsule = GetComponent<CapsuleCollider>();
            m_CapsuleHeight = m_Capsule.height;
            m_CapsuleCenter = m_Capsule.center;

            m_Rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
            m_OrigGroundCheckDistance = m_GroundCheckDistance;

            TPUC = GameObject.Find ("catController").GetComponent<ThirdPersonUserControl>();
        }