當前位置: 首頁>>代碼示例>>C#>>正文


C# CharacterController類代碼示例

本文整理匯總了C#中CharacterController的典型用法代碼示例。如果您正苦於以下問題:C# CharacterController類的具體用法?C# CharacterController怎麽用?C# CharacterController使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CharacterController類屬於命名空間,在下文中一共展示了CharacterController類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Start

 void Start()
 {
     _t = transform;
     _animator = GetComponent<Animator>();
     _controller = GetComponent<CharacterController>();
     _rigidbody = GetComponent<Rigidbody>();
 }
開發者ID:choang05,項目名稱:Puzzle-2,代碼行數:7,代碼來源:SrpgcMouseMovementController.cs

示例2: Start

    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        anim = GetComponent<Animator>();
        charControl = GetComponent<CharacterController>();
    }
開發者ID:DanStout,項目名稱:FablesOfSol,代碼行數:7,代碼來源:ChasesPlayer.cs

示例3: Start

    // Constants

    // Use this for initialization
	void Start ()
	{
    	// Set up the character controller and movement
        m_npcController = GetComponentInParent<CharacterController>();
        m_finalMovement = Vector3.zero;
		behaviour = NpcBehaviour.Linear       ;
	}
開發者ID:Aze22,項目名稱:GGJ2016,代碼行數:10,代碼來源:NPCScript.cs

示例4: Start

    // Use this for initialization
    private void Start()
    {
        m_CharacterController = GetComponent<CharacterController>();
        m_StepCycle = 0f;
        m_NextStep = m_StepCycle / 2f;
        m_Jumping = false;
        m_AudioSource = GetComponent<AudioSource>();

        // Get the controller to player map from the MultiSceneVariablesScripts
        ControllerID = -1;
        int player = PlayerID;
        MultiSceneVariablesScript script = GameObject.Find( "MultiSceneVariables" ).GetComponent<MultiSceneVariablesScript>();
        {
            int playeriter = 0;
            foreach ( int playercon in script.PlayerToController.ToArray() )
            {
                if ( ( player - 1 ) == playeriter )
                {
                    ControllerID = playercon;
                    break;
                }
                playeriter++;
            }
        }
        // Disable unused players
        if ( ControllerID == -1 )
        {
            gameObject.SetActive( false );
            enabled = false;
        }
    }
開發者ID:DrMelon,項目名稱:PotionCommotion,代碼行數:32,代碼來源:PlayerControllerScript.cs

示例5: Start

 public void Start()
 {
     seeker = GetComponent<Seeker>();
     controller = GetComponent<CharacterController>();
     //Start a new path to the targetPosition, return the result to the OnPathComplete function
     seeker.StartPath(transform.position, targetPosition, OnPathComplete);
 }
開發者ID:Super-Goat-Herders,項目名稱:ProjectGoat,代碼行數:7,代碼來源:AiStar4.cs

示例6: Awake

    // =============================================================================
    // =============================================================================
    // METHODS UNITY ---------------------------------------------------------------
    void Awake()
    {
        Config = GameObject.FindWithTag( "Config" ).GetComponent<Config>();
        Trans = transform;

        CC = gameObject.GetComponent<CharacterController>();
    }
開發者ID:Jonas90,項目名稱:iss,代碼行數:10,代碼來源:PlayerMovement.cs

示例7: Update

	// Update is called once per frame
	void Update () {
		if(Vector3.Distance(transform.position,player.position)<10){
			sighted = true;
			target = player.position;
			Debug.Log(sighted);
		}	
		float distA = Vector3.Distance(transform.position,pointA.position);
		float distB = Vector3.Distance(transform.position,pointB.position);
		if(distA<2){
			atA = true;
			atB = false;
			target = pointB.position;
		}
		if(distB<2){
			atB = true;
			atA = false;
			target = pointA.position;
		}
		if(Time.time > curTime+waitTime){
			seeker = GetComponent<Seeker>();
			seeker.StartPath(transform.position,target,OnPathComplete);
			charctlr = GetComponent<CharacterController>();
			curTime = Time.time;
		}
	}
開發者ID:kxh337,項目名稱:Sephone,代碼行數:26,代碼來源:GhostTwoPoint.cs

示例8: Start

	// Use this for initialization
	void Start () 
	{
        _animator = GetComponent<Animator>();
		_charCtrl = GetComponent<CharacterController>();
		m_AudioSource = GetComponent<AudioSource>();
		currTexture = myBody.GetComponent<SkinnedMeshRenderer> ().material.mainTexture;
	}
開發者ID:kamilion,項目名稱:UNETMovement,代碼行數:8,代碼來源:LocomotionPlayer.cs

示例9: Start

 void Start()
 {
     characterController = GetComponent<CharacterController>();
     characterParticles = GameObject.Find("Player/Flute Radius").GetComponent<ParticleSystem>();
     fluteCall1 = FMOD_StudioSystem.instance.GetEvent("event:/sfx/player/flute1");
     fluteCall2 = FMOD_StudioSystem.instance.GetEvent("event:/sfx/player/flute2");
 }
開發者ID:mightypants,項目名稱:apackofalpacas,代碼行數:7,代碼來源:PlayerMovement.cs

示例10: Awake

    void Awake()
    {
        gc = GameObject.FindWithTag("GameController").GetComponent<GameController>();

        cc = GetComponent<CharacterController>();
        move = new Vector3();
    }
開發者ID:EternalGB,項目名稱:ldjam33,代碼行數:7,代碼來源:PlayerController.cs

示例11: Awake

    void Awake()
    {
        yaw = transform.localEulerAngles.y;

        // get a reference to the Character Controller
        characterController = GetComponent<CharacterController>();
    }
開發者ID:yunspace,項目名稱:unite15-network-game,代碼行數:7,代碼來源:PlayerController.cs

示例12: Start

 void Start()
 {
     state = new ClientWiiState();
     playerCam = transform.FindChild("Main Camera");
     controller = GetComponent<CharacterController>();
     bJump = true;
 }
開發者ID:timmutton,項目名稱:r2d2_assignment,代碼行數:7,代碼來源:playerMovement.cs

示例13: Reset

 void Reset()
 {
     characterController = GetComponentInChildren<CharacterController>();
     navMeshAgent = GetComponentInChildren<NavMeshAgent>();
     joystickNavigationController = GetComponent<JoystickNavigationController>();
     camera = GetComponentInChildren<Camera>().gameObject;
 }
開發者ID:Foxshiver,項目名稱:Projet_Immersia,代碼行數:7,代碼來源:NavigationManager.cs

示例14: FixedUpdate

    //Update is called once per frame
    void FixedUpdate()
    {
        //Defines how player movement works
        controller = GetComponent<CharacterController>();
        movement.x = 0;

        if(Input.GetKey(moveLeft))
            movement.x = -moveSpeed;
        else if(Input.GetKey(moveRight))
            movement.x = moveSpeed;

        if(controller.isGrounded){
            vertSpeed = 0.0f;

            if(Input.GetKey(moveJump)){
                vertSpeed = jumpSpeed;
            }
        }

        vertSpeed -= gravity*Time.deltaTime;
        movement.y = vertSpeed;

        controller.Move(movement * Time.deltaTime);
        //End player movement
    }
開發者ID:Shadowist,項目名稱:OGM2013February,代碼行數:26,代碼來源:PlayerMovement.cs

示例15: Start

 public void Start()
 {
     seeker = GetComponent<Seeker>();
     controller = GetComponent<CharacterController>();
     FindTarget();
     StartCoroutine(GetNewPath());
 }
開發者ID:uudkdevs2013,項目名稱:TheSonOfBSF,代碼行數:7,代碼來源:AstarAI.cs


注:本文中的CharacterController類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。