Inheritance: UnityEngine.MonoBehaviour
Esempio n. 1
0
        private void Start()
        {
			m_Cam = Camera.allCameras[0].transform;
            m_Character = GetComponent<ThirdPersonCharacter>();
			anim = GetComponent<Animator>();
			playerPos = transform.position;
        }
 private void Start() {
   agent = GetComponentInChildren<NavMeshAgent>();
   character = GetComponent<ThirdPersonCharacter>();
   
   agent.updateRotation = false;
   agent.updatePosition = true;
 }
        private bool m_Jump;                      // the world-relative desired move direction, calculated from the camForward and user input.
        


        private void Start()
        {

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent<ThirdPersonCharacter>();
           
        }
Esempio n. 4
0
 private void Start()
 {
     m_moveEnabled = true;
     // get the third person character ( this should never be null due to require component )
     m_character = GetComponent<ThirdPersonCharacter>();
     player = GameObject.FindGameObjectWithTag("Player").transform;
 }
Esempio n. 5
0
    IEnumerator _CrossDoor(UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter character)
    {
        fade.FadeIn();

        while (fade.IsFading())
        {
            yield return null;
        }

        Vector3 posicionDestino = _spawnPoint.transform.position;
        Vector3 rotacionDestino = _spawnPoint.transform.eulerAngles;

        agent.enabled = false;
        character.transform.position = posicionDestino;
        character.transform.eulerAngles = rotacionDestino;
        agent.enabled = true;

        SceneManager.UnloadSceneAsync(sceneToUnload);
        AsyncOperation ao = SceneManager.LoadSceneAsync(sceneToload, LoadSceneMode.Additive);

        while (!ao.isDone)
        {
            yield return null;
        }

        fade.FadeOut();

        GameObject.Find("Button").GetComponent<Click>().GetPosicionActual(posicion);
        GameObject.Find("Sarah").GetComponent<AICharacterControl>().SetTarget(posicionDestino);
    }
Esempio n. 6
0
    IEnumerator _CrossDoor(UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter character)
    {
        fade.FadeIn();

        while (fade.IsFading())
        {
            yield return(null);
        }

        Vector3 posicionDestino = _spawnPoint.transform.position;
        Vector3 rotacionDestino = _spawnPoint.transform.eulerAngles;

        character.transform.position    = posicionDestino;
        character.transform.eulerAngles = rotacionDestino;

        SceneManager.UnloadSceneAsync(sceneToUnload);
        AsyncOperation ao = SceneManager.LoadSceneAsync(sceneToload, LoadSceneMode.Additive);

        while (!ao.isDone)
        {
            yield return(null);
        }

        fade.FadeOut();
    }
Esempio n. 7
0
		public Transform target;                                    // target to aim for


		private void Start () {
			// 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;
		}
Esempio n. 8
0
 // Use this for initialization
 void Start()
 {
     healthPositionX = 15;
     healthPositionY = 15;
     player = GameObject.FindGameObjectWithTag ("Player");
     controller = player.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
     currentHealth = full;
     currentItems = noItems;
 }
Esempio n. 9
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;
 }
Esempio n. 10
0
 private void Awake()
 {
     player         = this;// инициализация синглтона
     rb             = GetComponent <Rigidbody>();
     firstCoroutOn  = false;
     secondCoroutOn = false;
     thirdCoroutOn  = false;
     character      = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
 }
Esempio n. 11
0
    /*public bool isMoving;
     * public float timer, timerBeforeTrigger;*/

    public void Start()
    {
        playerRb       = player.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
        offsetRotation = transform.position;
        transform.LookAt(new Vector3(player.position.x, player.position.y + offsetVerticalFocus, player.position.z));
        distance = Vector3.Distance(player.position, transform.position);
        //TODO: Change that
        startY = transform.position.y;
    }
Esempio n. 12
0
    void Start()
    {
        cursor = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <cursor>();

        if (lisasimopson == null)
        {
            GameObject playerGO = GameObject.FindWithTag("Player");
            lisasimopson = playerGO.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
        }
    }
Esempio n. 13
0
        // Use this for initialization
        private void Start()
        {
            // 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;
            target = GameObject.FindGameObjectWithTag ("Nexus").transform;
        }
Esempio n. 14
0
    void Start()
    {
        agent                = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
        character            = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
        agent.updateRotation = false;
        agent.updatePosition = true;

        animator = GetComponent <Animator>();
        animator.SetBool("IsWaitingWithGift", true);
        animator.SetFloat("SpeedMovement", speedAnimation);
    }
 private void Start()
 {
     if (Camera.main != null) {
     m_Cam = Camera.main.transform;
       }
       else {
     Debug.LogWarning(
             "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
       }
       m_Character = GetComponent<ThirdPersonCharacter>();
 }
    void Start()
    {
        // get reference to interaction script
        interactionScript = thirdPersonController.GetComponent <Interaction>();
        // get reference to the third person character controller in order to change the move speed multiplier variable.
        thirdPersonCharacterScript = thirdPersonController.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();

        // switch available dialogue circles
        SecondCircle.SetActive(false);
        BeginningCircle.SetActive(true);
    }
    // Use this for initialization
    void Start()
    {
        thirdPersonController = gameObject.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();

        agent = GetComponent <UnityEngine.AI.NavMeshAgent>();
        agent.updateRotation = false;
        agent.updatePosition = true;

        AICharControl = owner.GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>();
        SetDestination();
    }
Esempio n. 18
0
        // Use this for initialization
        void Start()
        {
            drone = GameObject.FindGameObjectWithTag("Drone");
            mainPlayer = GameObject.FindGameObjectWithTag("Player").GetComponent<ThirdPersonCharacter>();
			audioSource = GetComponent<AudioSource>();
			movementState = MOVEMENT_STATE.MOVING;
			cameraView = CAMERA_VIEW.PLAYER;
			health = maxHealth;

			bloodOverlay = imageOverlayObject.GetComponent<Image>();
			SetHealth(100);
		}
Esempio n. 19
0
        // Use this for initialization
        void Start()
        {
			player = gameObject;
			drone = GameObject.FindGameObjectWithTag("Drone");

			cam = GetComponentInChildren<Camera>();
			DroneCAM = drone.GetComponentInChildren<Camera>();
            mainCharacter = GetComponent<ThirdPersonCharacter>();
			playerControl = mainCharacter.GetComponent<Player>();
			screenFocus = mainCharacter.GetComponent<ScreenFocus>();

			DroneCAM.enabled = false;
		}
Esempio n. 20
0
    private void Start()
    {
        // get the components on the object we need ( should not be null due to require component so no need to check )
        agent     = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
        character = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();

        agent.updateRotation = false;
        agent.updatePosition = true;
        animator             = GetComponent <Animator>();

        currentTarget = targets[0];
        // isCurrentTaskComplited = false;
    }
Esempio n. 21
0
    // Use this for initialization
    private void Start()
    {
        agent     = GetComponent <UnityEngine.AI.NavMeshAgent>();
        character = GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();

        agent.updateRotation = false;
        agent.updatePosition = true;

        shootingScript = GetComponent <ShootingScript>();
        // Old find target, using field of view list now
        //StartCoroutine(FindTarget());
        state = State.wander;

        timer = wanderTimer;
    }
Esempio n. 22
0
        private void Start()
        {
            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            } else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent<ThirdPersonCharacter>();
        }
        private bool m_Jump;                      // the world-relative desired move direction, calculated from the camForward and user input.


        private void Start()
        {
            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject);
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent <ThirdPersonCharacter>();
        }
Esempio n. 24
0
        private void Start()
        {
            _camera       = Camera.main;
            _agent        = GetComponent <NavMeshAgent>();
            _character    = GetComponent <ThirdPersonCharacter>();
            _path         = new NavMeshPath();
            _startPoint   = transform.position;
            _concatArray  = new Vector3[0];
            _points       = new Queue <Vector3>();
            _currentPoint = new Queue <GameObject>();

            _lineRenderer            = new GameObject("LineRenderer").AddComponent <LineRenderer>();
            _lineRenderer.startWidth = 0.1F;
            _lineRenderer.endWidth   = 0.1F;
            _lineRenderer.material   = new Material(Shader.Find("Mobile/Particles/Additive"));
            _lineRenderer.startColor = _colorRed;
            _lineRenderer.endColor   = _colorGreen;
        }
Esempio n. 25
0
        private void OnTriggerEnter(Collider other)
        {
            _isHealing = true;

            ThirdPersonCharacter player = other.gameObject.GetComponent <ThirdPersonCharacter>();

            if (player != null)
            {
                if (Repeating)
                {
                    StartCoroutine(Heal(player, healRepeatRate));
                }
                else
                {
                    player.Heal(healAmount);
                }
            }
        }
Esempio n. 26
0
 // Use this for initialization
 void Start()
 {
     agent                = GetComponent <NavMeshAgent>();
     character            = GetComponent <ThirdPersonCharacter>();
     agent.updatePosition = true;
     agent.updateRotation = false;
     state                = EnemyAI.State.PATROL;
     mask   = LayerMask.GetMask("Player");
     player = GameObject.FindWithTag("Player");
     awaken = false;
     anim.SetBool("isDead", true);
     gas.SetActive(false);
     lightHelmet.SetActive(false);
     timeAlive   = 1;
     hasRespawn  = false;
     timer       = giveUpTimer;
     awakenTimer = 2f;
 }
Esempio n. 27
0
        public float sightDist = 18.5f;         //How far out the raycast is that the guard can see to detect to chase a player


        //use this for initialization
        void Start()
        {
            agent     = GetComponent <NavMeshAgent> ();
            character = GetComponent <ThirdPersonCharacter> ();


            agent.updatePosition = true;
            agent.updateRotation = false;

            //Gets all of the cubes which are tagged waypoint. The guard will randomly patrol between these points
            waypoints        = GameObject.FindGameObjectsWithTag("waypoint");
            waypointInd      = Random.Range(0, waypoints.Length);       //Randomly choose a starting waypoint
            state            = enemySight.State.PATROL;
            alive            = true;
            heightMultiplier = 1.36f;              //Place the raycast at the guard's eyes

            //StartCoroutine ("FSM");
        }
Esempio n. 28
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;
    }
Esempio n. 29
0
        // Use this for initialization
        void Start()
        {
            agent = GetComponent<NavMeshAgent>();
            character = GetComponent<ThirdPersonCharacter>();
            // randomizing the points
            waypoints = GameObject.FindGameObjectsWithTag("Waypoints");
            wayPointInd = Random.Range(0,waypoints.Length);


            agent.updatePosition = true;
            agent.updateRotation = false;
            state = EnemySight1.State.PATROL;
            alive = true;
            //Start StateMachine
            StartCoroutine("StateMachine");

            heightMultiplier = 1.36f;
        }
Esempio n. 30
0
        private bool m_Jump;                      // the world-relative desired move direction, calculated from the camForward and user input.


        private void Start()
        {
            // get the transform of the main camera
            if (m_Cam == null)
            {
                if (Camera.main != null)
                {
                    m_Cam = Camera.main.transform;
                }
                else
                {
                    Debug.LogWarning("Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                }
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent <ThirdPersonCharacter>();
        }
Esempio n. 31
0
		// Use this for initialization
		void Awake()
		{
			enemySight = GetComponent<EnemySight2>();
			nav = GetComponent<NavMeshAgent>();
			player = GameObject.FindGameObjectWithTag("Player").transform;
			audioSource = GetComponent<AudioSource>();
			globalLastPlayerSighting = GameObject.FindGameObjectWithTag("GM").GetComponent<LastPlayerSighting>();
			character = GetComponent<ThirdPersonCharacter>();
			playerScript = player.GetComponent<Player>();

			nav.updatePosition = true;
			nav.updateRotation = false;

			currentState = AI_STATE.PATROLLING;
			animator = GetComponent<Animator>();

			nextShotDelay = 0.0f;
		}
Esempio n. 32
0
        void Start()
        {
            agent = GetComponent<NavMeshAgent>();
            character = GetComponent<ThirdPersonCharacter>();

            agent.updatePosition = true;
            agent.updateRotation = false;

            waypoints = GameObject.FindGameObjectsWithTag("Node");
            waypointInd = UnityEngine.Random.Range(0, waypoints.Length); //Might need System for Random

            playerCollider = player.GetComponent<Collider>();

            state = enemyScript.State.PATROL;

            alive = true;

            heightMultiplier = 1.4f;
        }
        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. 34
0
        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent     = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;

            hidespots = GameObject.FindGameObjectsWithTag("hidespot");

            agent.SetDestination(getrandomtarget());

            curtime  = Time.time;
            curtime1 = Time.time;

            InvokeRepeating("OnTriggerEnter", 1.0f, 2.0f);
            InvokeRepeating("HitByRay", 1.0f, 2.0f);
        }
Esempio n. 35
0
        // Start is called before the first frame update
        void Start()
        {
            agent     = GetComponent <NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updatePosition = true;
            agent.updateRotation = false;

            waypoints   = GameObject.FindGameObjectsWithTag("waypoint");
            waypointIND = Random.Range(0, waypoints.Length);

            state = enemySightAI.State.PATROL;

            alive = true;

            heightMultiplier = 1.36f;

            StartCoroutine("FSM");
        }
Esempio n. 36
0
        // Use this for initialization
        void Start()
        {
            agent            = GetComponent <NavMeshAgent>();
            agent.baseOffset = 0;
            agent.height     = 2f;
            character        = GetComponent <ThirdPersonCharacter>();

            agent.updatePosition = true;
            agent.updateRotation = false;

            wayPoints     = GameObject.FindGameObjectsWithTag("WayPoint");
            wayPointIndex = Random.Range(0, wayPoints.Length);

            state = State.PATROL;
            alive = true;

            StartCoroutine("FSM");
            // FSM? final state machine
        }
Esempio n. 37
0
        private void Start()
        {
            // 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>();
            player            = GameObject.FindGameObjectWithTag("Player");
            activeTargetIndex = 0;
            activeTarget      = targets [activeTargetIndex];
            coolingDown       = gunCoolDown;


            if (activeTarget != null)
            {
                agent.SetDestination(activeTarget.position);
            }


            agent.updateRotation = false;
            agent.updatePosition = true;
        }
Esempio n. 38
0
        // Use this for initialization
        void Start()
        {
            agent = GetComponent<NavMeshAgent>();
            character = GetComponent<ThirdPersonCharacter>();
            // randomizing the points
            //waypoints = GameObject.FindGameObjectsWithTag("Waypoints");
            //wayPointInd = Random.Range(0, waypoints.Length);

            PlayerColl = player.GetComponent<Collider>();
            lastPlayerSighting = GameObject.FindGameObjectWithTag("GM").GetComponent<LastPlayerSighting>();
            //EAS = GameObject.FindGameObjectWithTag("GM").GetComponent<EnemyAlertSys>();
            personalLastSighting = lastPlayerSighting.resetPosition;
            agent.updatePosition = true;
            agent.updateRotation = false;
            state = CameraScript.State.PATROL;
            alive = true;
            Detected = false;
            //Start StateMachine
            StartCoroutine("StateMachine");
        }
        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent     = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;


            if (isHisTurn)
            {
                Debug.Log("Its My Turn");
                whoseTurn = transform;
            }
            else
            {
                //Move Randomly
            }
        }
Esempio n. 40
0
        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent     = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;


            if (target == null)
            {
                targets = GameObject.FindGameObjectsWithTag("Player");

                if (targets != null)
                {
                    target = targets[0].transform;
                }
            }
        }
Esempio n. 41
0
 private void FindClosestTarget()
 {
     GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
     if (players.Length > 0)
     {
         float     minDistance   = Vector3.Distance(players[0].transform.position, gameObject.transform.position);
         Transform currentTarget = null;
         foreach (GameObject player in players)
         {
             float tmp = Vector3.Distance(player.transform.position, gameObject.transform.position);
             ThirdPersonCharacter thirdPersonCharacter = player.GetComponent <ThirdPersonCharacter>();
             if (tmp <= minDistance && !thirdPersonCharacter.m_Dead)
             {
                 minDistance   = tmp;
                 currentTarget = player.transform;
             }
         }
         this.SetTarget(currentTarget);
     }
 }
        // Use this for initialization
        void Start()
        {
            player = GameObject.FindGameObjectWithTag("Player").transform;

            //----------------------------
            agent     = GetComponent <NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updatePosition = true;
            agent.updateRotation = false;

            // set your initial state
            state = basicAI.State.PATROL;

            alive = true;

            //Start FSM

            StartCoroutine("FSM");
        }
    private void GameOver()
    {
        Debug.Log("You are dead");

        // Update best score
        if (File.Exists(Application.persistentDataPath + bestScoreFileName))
        {
            string currentBestScore = File.ReadAllText(Application.persistentDataPath + bestScoreFileName);

            Text textLabel = null;
            UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter thirdPerson = gameObject.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
            if (thirdPerson != null)
            {
                thirdPerson.m_MoveSpeedMultiplier = 0;
                thirdPerson.m_AnimSpeedMultiplier = 0;
                Transform child = MessageBox.transform.Find("InfoTextLabel");
                textLabel = child.GetComponent <Text>();
            }

            if (int.Parse(currentBestScore) < collectedPoints)
            {
                File.WriteAllText(Application.persistentDataPath + bestScoreFileName, collectedPoints.ToString());
                if (textLabel != null)
                {
                    textLabel.text = "Brawo! Właśnie pobiłeś rekord gry! Spróbuj swoich sił jeszcze raz :)";
                    MessageBox.SetActive(true);
                }
            }
            else
            {
                if (textLabel != null)
                {
                    textLabel.text = "Koniec gry! Niestety nie udało Ci się pobić rekordu. Spróbuj swoich sił jeszcze raz :)";
                    MessageBox.SetActive(true);
                }
            }
        }

        //Debug.Log("return to menu");
        // SceneManager.LoadScene("MainMenu");
    }
Esempio n. 44
0
        private void Start()
        {
            target         = GameObject.FindWithTag("Player").transform;
            hearing_radius = Resources.Load <GameObject>("Cylinder");
            wander_target  = RandomNavSphere(transform.position, 10, -1);
            floor          = GameObject.FindWithTag("Floor");
            if (blind)
            {
                hearing_radius = Instantiate(hearing_radius);
                hearing_radius.transform.localScale = new Vector3(hearing_distance, .0000001f, hearing_distance);
                hearing_radius.transform.position   = new Vector3(hearing_radius.transform.position.x, floor.transform.position.y + .000000001f - 0.15f, hearing_radius.transform.position.z);
            }
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent     = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;

            height = 1.36f;
        }
Esempio n. 45
0
	    // Use this for initialization
	    void Start () 
	    {
            anim = GetComponentInChildren<Animator>();
            deltaPosition = transform.position;

            agent = GetComponentInChildren<NavMeshAgent>();
		    character = GetComponent<ThirdPersonCharacter>();
		    
		    GameObject playerObject = GameObject.FindWithTag("Player") as GameObject;
		    player = playerObject.transform;

		    agent.updateRotation = true;
		    agent.updatePosition = true;
            agent.speed = moveSpeed;
		
		    lastSeen = transform;

		    //initial setup for timer (to be initialized depending on weapon)
		    shootTimer = gunTimer;
			setWeapon (weapon);

	    }
        private void Start()
        {
            if (isLocalPlayer) {
                GetComponentInChildren (typeof(Camera)).gameObject.SetActive (true);
            } else {
                GetComponentInChildren (typeof(Camera)).gameObject.SetActive (false);
            }
            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject);
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent<ThirdPersonCharacter>();
        }
        private void Start()
        {
            // Disable if character not owned by client
            NetworkIdentity n_identity = GetComponent<NetworkIdentity>();
            if (n_identity != null && !n_identity.isLocalPlayer) {
                enabled = false;
            }

            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character (this should never be null due to require component)
            m_Character = GetComponent<ThirdPersonCharacter>();
        }
        // Use this for initialization
        void Start()
        {
            agent = GetComponent<NavMeshAgent>();
            character = GetComponent<ThirdPersonCharacter>();
            body = GetComponentInChildren<SkinnedMeshRenderer>();

            GameObject bar = GameObject.Find("Bar");
            emplacementbar = bar.transform;

            GameObject mirror = GameObject.Find("Mirror1");
            emplacementmirror = mirror.transform;

            GameObject dancefloor = GameObject.Find("Dancefloor");
            emplacementpiste = dancefloor.transform;

            tables = new GameObject[8];

            GameObject table1 = GameObject.Find("Sofa1");
            GameObject table2 = GameObject.Find("Sofa2");
            GameObject table3 = GameObject.Find("Sofa3");
            GameObject table4 = GameObject.Find("Sofa4");
            GameObject table5 = GameObject.Find("Sofa5");
            GameObject table6 = GameObject.Find("Sofa6");
            GameObject table7 = GameObject.Find("Sofa7");
            GameObject table8 = GameObject.Find("Sofa8");

            tables[0] = table1;
            tables[1] = table2;
            tables[2] = table3;
            tables[3] = table4;
            tables[4] = table5;
            tables[5] = table6;
            tables[6] = table7;
            tables[7] = table8;

            //emplacementtable = table.transform;
        }
        private void Start()
        {
            var cam = GameObject.FindWithTag("MainCamera");

            // get the transform of the main camera
            if (cam != null)
            {
                m_Cam = cam.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent<ThirdPersonCharacter>();

            //make the character spawn on a road
            //var road = GameObject.FindGameObjectsWithTag("Road").GetRandomValue().transform.position;

            //transform.position = road;
        }
Esempio n. 50
0
 private void Start()
 {
     m_Character = GetComponent<ThirdPersonCharacter>();
     boneSpawner = GameObject.FindGameObjectWithTag("boneSpawner");
 }
Esempio n. 51
0
        // Use this for initialization
        private void Start()
        {
            // 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;
            frozen = false;

            ghoulDead = false;

            agent.updatePosition = true;

            player = GameObject.Find("Auron").transform;
            baseCar = GameObject.Find("baseCar").transform;
            target = player;
            InvokeRepeating("checkDistances", 0, 1.0f);
        }
Esempio n. 52
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     controller = player.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
     playerInTerritory = false;
     hasPlayerItems = false;
     paused = false;
     agent = GetComponent<NavMeshAgent> ();
     agent.destination = waypoints [waypointCounter].position;
 }
        private void Start()
        {
            player = playerObject.tag;

            multiString = PlayerPrefs.GetString ("MultiBool");

            if (multiString.Equals ("True")) {
                multi = true;
            } else {
                multi = false;
            }

            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent<ThirdPersonCharacter>();
        }
Esempio n. 54
0
        void Awake()
        {
            mainPlayer = GameObject.FindGameObjectWithTag("Player").GetComponent<ThirdPersonCharacter>();
			playerControl = mainPlayer.GetComponent<Player>();
            Drone = GetComponent<GameObject>();
        }
Esempio n. 55
0
 void Start ()
 {
     slow = GetComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
 }
        // Use this for initialization
        private void Start()
        {
            // 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;
            m_Animator = GetComponent<Animator>();
            myHealth = GetComponent<EnemyHealth> ();

            target = GameObject.FindWithTag ("Player").GetComponent<Transform>();

            StartCoroutine(NewHeading());
        }