本文整理汇总了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>();
}
示例2: Start
void Start()
{
player = GameObject.FindGameObjectWithTag("Player");
anim = GetComponent<Animator>();
charControl = GetComponent<CharacterController>();
}
示例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 ;
}
示例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;
}
}
示例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);
}
示例6: Awake
// =============================================================================
// =============================================================================
// METHODS UNITY ---------------------------------------------------------------
void Awake()
{
Config = GameObject.FindWithTag( "Config" ).GetComponent<Config>();
Trans = transform;
CC = gameObject.GetComponent<CharacterController>();
}
示例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;
}
}
示例8: Start
// Use this for initialization
void Start ()
{
_animator = GetComponent<Animator>();
_charCtrl = GetComponent<CharacterController>();
m_AudioSource = GetComponent<AudioSource>();
currTexture = myBody.GetComponent<SkinnedMeshRenderer> ().material.mainTexture;
}
示例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");
}
示例10: Awake
void Awake()
{
gc = GameObject.FindWithTag("GameController").GetComponent<GameController>();
cc = GetComponent<CharacterController>();
move = new Vector3();
}
示例11: Awake
void Awake()
{
yaw = transform.localEulerAngles.y;
// get a reference to the Character Controller
characterController = GetComponent<CharacterController>();
}
示例12: Start
void Start()
{
state = new ClientWiiState();
playerCam = transform.FindChild("Main Camera");
controller = GetComponent<CharacterController>();
bJump = true;
}
示例13: Reset
void Reset()
{
characterController = GetComponentInChildren<CharacterController>();
navMeshAgent = GetComponentInChildren<NavMeshAgent>();
joystickNavigationController = GetComponent<JoystickNavigationController>();
camera = GetComponentInChildren<Camera>().gameObject;
}
示例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
}
示例15: Start
public void Start()
{
seeker = GetComponent<Seeker>();
controller = GetComponent<CharacterController>();
FindTarget();
StartCoroutine(GetNewPath());
}