本文整理汇总了C#中CharacterController类的典型用法代码示例。如果您正苦于以下问题:C# CharacterController类的具体用法?C# CharacterController怎么用?C# CharacterController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CharacterController类属于命名空间,在下文中一共展示了CharacterController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: OnInitializeEntity
public override void OnInitializeEntity ()
{
cc = GetComponent<CharacterController>();
transform.parent = this.parentMap.transform;
bound_z_position = eTransform.localPosition.z;
RecalculateJumpDistance();
OnBlockEntry(x,y,z);
jumpHeight_Blocks = (int)((float)jumpHeight / parentMap.tileScale.y);
//We'll randomise our starting direction if we have chosen to
if(randomiseStartingDirection){
currentDirection = UnityEngine.Random.Range(0,2);
if(currentDirection == 0){
currentDirection = -1;
}
}
else{
currentDirection = startingDirection;
//If something odd has been put in, I will just disregard and randomise
if(currentDirection == 0 || currentDirection > 1 || currentDirection < -1){
currentDirection = UnityEngine.Random.Range(0,2);
if(currentDirection == 0){
currentDirection = -1;
}
}
}
}
开发者ID:moderndelta137,项目名称:Shadow_Sword,代码行数:33,代码来源:PlatformerEntity.cs
示例17: Start
// Use this for initialization
void Start()
{
Cursor.visible = false; // temporarily set to true for testing
eyes = this.transform.Find("Eyes").gameObject;
body = this.transform.Find("geckstronautAnimatedWithGun").gameObject;
startPosition = this.transform.position; // this will be the place the player responds to each time he dies
eyesStartPos = eyes.transform.position;
bodyStartPos = body.transform.position;
startRot = this.transform.rotation;
eyesStartRot = eyes.transform.rotation;
bodyStartRot = body.transform.rotation;
characterController = GetComponent<CharacterController>();
firstPersonCamera = this.GetComponentInChildren<Camera>();
geckAnimator = this.transform.Find("geckstronautAnimatedWithGun").GetComponent<Animator>();
geckAnimator.SetBool("HasGun", false);
geckAnimator.SetBool("Idle", false);
geckAnimator.SetBool("Walking", false);
geckAnimator.SetBool("Running", false);
geckAnimator.SetBool("Shooting", false);
manager = GameObject.FindGameObjectWithTag("GameController");
mouseSensitivity = PlayerPrefs.GetFloat ("Mouse Sensitivity");
//manager.GetComponent<GameManagerScript>().mouseSensitivity; // get mouse sensitivity from GameController object
//if (isLocalPlayer) {
// this.GetComponentInChildren<Camera>().enabled = true;
// this.GetComponentInChildren<AudioListener>().enabled = true;
//}
}
开发者ID:bpgeck,项目名称:Voxelnauts,代码行数:36,代码来源:AstroFirstPersonControl.cs
示例18: Update
// Update is called once per frame
void Update()
{
//rotateLeftRight = Input.GetAxis ("Rotate");
forward = Input.GetAxis ("Vertical") * moveSpeed;
LRward = Input.GetAxis ("Horizontal") * moveSpeed;
mouseLR = Input.GetAxis ("Mouse X") * mouseSensitivity;
mouseUD = Input.GetAxis ("Mouse Y") * mouseSensitivity;
characterController = GetComponent<CharacterController>();
if( verticalVelocity > -1 )
verticalVelocity += Physics.gravity.y * Time.deltaTime / 0.8f;
Debug.Log (verticalVelocity);
if ( Input.GetButtonDown("Jump") && characterController.isGrounded) {
Debug.Log("jump!");
verticalVelocity = jumpSpeed;
}
desiredUpDown -= mouseUD;
desiredLeftRight -= mouseLR;
desiredUpDown = Mathf.Clamp (desiredUpDown, -60f, 60f);
Camera.main.transform.rotation = Quaternion.Euler (desiredUpDown, -desiredLeftRight , 0);
transform.rotation = Quaternion.Euler (0, -desiredLeftRight , 0);
//transform.Rotate (0,mouseLR,0);
Vector3 speed = new Vector3 (LRward, verticalVelocity, forward); //go forward
speed = transform.TransformDirection(speed);
Debug.Log ("Speed:" + speed);
characterController.Move (speed);
}
开发者ID:htcHIMA,项目名称:untiy_firstPersonGame,代码行数:31,代码来源:firstParse.cs
示例19: Start
// Use this for initialization
void Start () {
controller = GetComponent<CharacterController>();
// Animation.
animator = GetComponent<Animator>();
animator.Play("Idle");
}
开发者ID:puzzud,项目名称:Flipper,代码行数:8,代码来源:HeroControl.cs
示例20: Start
void Start()
{
_cc = GetComponent<CharacterController> ();
arrivalNumber = 0;
randomStartSpeed = Random.Range (5, 10);
cruisingSpeed = randomStartSpeed;
}
开发者ID:TheNorthEestern,项目名称:infinite-road,代码行数:7,代码来源:NpcBehavior.cs
注:本文中的CharacterController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论