private void Start() { //Get other RPG Character components. superCharacterController = GetComponent <SuperCharacterController>(); rpgCharacterController = GetComponent <RPGCharacterControllerFREE>(); rpgCharacterInputController = GetComponent <RPGCharacterInputControllerFREE>(); navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>(); //Check if Animator exists, otherwise pause script. animator = GetComponentInChildren <Animator>(); if (animator == null) { Destroy(this); return; } //Setup Collider and Rigidbody for collisions. capCollider = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); if (rb != null) { //Set restraints on startup if using Rigidbody. rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } SwitchCollisionOn(); //Set currentState to idle on startup. currentState = RPGCharacterState.Idle; rpgCharacterState = RPGCharacterState.Idle; }
void Start() { // Put any code here you want to run ONCE, when the object is initialized input = gameObject.GetComponent <MegamanInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground if (!IsSideScrolling) { lookDirection = transform.forward; } else { lookDirection = transform.right; } // Set our currentState to idle on startup currentState = PlayerStates.Idle; // Keep temporary z position to locking spawnPositionZ = transform.position.z; }
private void Start() { // Get other RPG Character components. superCharacterController = GetComponent <SuperCharacterController>(); // Check if Animator exists, otherwise pause script. animator = GetComponentInChildren <Animator>(); if (animator == null) { Debug.LogError("ERROR: THERE IS NO ANIMATOR COMPONENT ON CHILD OF CHARACTER."); Debug.Break(); } // Setup Collider and Rigidbody for collisions. capCollider = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); // Set restraints on startup if using Rigidbody. if (rb != null) { rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } rpgCharacterController.OnLockMovement += LockMovement; rpgCharacterController.OnUnlockMovement += UnlockMovement; RPGCharacterAnimatorEvents animatorEvents = rpgCharacterController.GetAnimatorTarget().GetComponent <RPGCharacterAnimatorEvents>(); animatorEvents.OnMove.AddListener(AnimatorMove); }
// Use this for initialization void Start() { input = PlayerTarget.GetComponent<PlayerInputController>(); machine = PlayerTarget.GetComponent<PlayerMachine>(); controller = PlayerTarget.GetComponent<SuperCharacterController>(); target = PlayerTarget.transform; }
private void Awake() { // Cache input and animator control playerInput = GetComponent <PlayerInput>(); playerAnimationControl = GetComponent <PlayerAnimationControl>(); superCharacterController = GetComponent <SuperCharacterController>(); // Cache animator and rigidbody anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody>(); // Get the camera transform m_Cam = playerCamera.transform; /* * // Get third person character reference * m_Character = GetComponent<ThirdPersonCharacter>(); */ // Set the current state to idle currentState = CharacterState.Idle; playerCharacterState = CharacterState.Idle; if (currentItem == CharacterItem.Sword) { anim.SetInteger("Weapon", 1); anim.SetTrigger("WeaponUnsheathTrigger"); } //Idle_EnterState(); // Make it live! isAlive = true; }
protected override void _StartAction(RPGCharacterController controller, EmptyContext context) { Collider ladder = controller.ladder; SuperCharacterController superCharacterController = movement.GetComponent <SuperCharacterController>(); float threshold = 1f; Vector3 ladderTop = new Vector3(ladder.transform.position.x, ladder.bounds.max.y, ladder.transform.position.z); Vector3 ladderBottom = new Vector3(ladder.transform.position.x, ladder.bounds.min.y, ladder.transform.position.z); float distanceFromTop = (controller.transform.position - ladderTop).magnitude; float distanceFromBottom = (controller.transform.position - ladderBottom).magnitude; // If the top of the ladder is below the character's head, climb onto the top of the ladder. if (distanceFromTop < distanceFromBottom && distanceFromTop < threshold) { movement.ClimbLadder(false); controller.ClimbLadder(5); movement.currentState = RPGCharacterState.ClimbLadder; } else if (distanceFromBottom < distanceFromTop && distanceFromBottom < threshold) { movement.ClimbLadder(true); controller.ClimbLadder(6); movement.currentState = RPGCharacterState.ClimbLadder; } }
void Start() { input = PlayerTarget.GetComponent <PlayerInputController>(); machine = PlayerTarget.GetComponent <PlayerMachine>(); controller = PlayerTarget.GetComponent <SuperCharacterController>(); target = PlayerTarget.transform; }
void Start() { // Put any code here you want to run ONCE, when the object is initialized // From UnityChan locomotion script // Animatorコンポーネントを取得する anim = GetComponent <Animator>(); // CapsuleColliderコンポーネントを取得する(カプセル型コリジョン) col = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); //メインカメラを取得する cameraObject = GameObject.FindWithTag("MainCamera"); // CapsuleColliderコンポーネントのHeight、Centerの初期値を保存する orgColHight = col.height; orgVectColCenter = col.center; // From PlayerMachine input = gameObject.GetComponent <PlayerInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
// Use this for initialization void Start() { currentDistance = (maxDistance + minDistance) * 0.5f; mario = target.GetComponent <MarioMachine>(); controller = target.GetComponent <SuperCharacterController>(); input = target.GetComponent <MarioInput>(); }
// Use this for initialization void Start() { if(m_playerTarget != null) { input = m_playerTarget.GetComponent<PlayerInputController>(); machine = m_playerTarget.GetComponent<PlayerMachine>(); controller = m_playerTarget.GetComponent<SuperCharacterController>(); } }
void Start() { // Put any code here you want to run ONCE, when the object is initialized // Grab the controller object from our object controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
void Awake() { Collision = GetComponent <ThirdPersonCameraCollisionHandler>(); _controller = PlayerTarget.GetComponent <SuperCharacterController>(); _target = PlayerTarget.transform; _targetPosition = _target.position; _targetPosition.y = _targetPosition.y + Height; _lookDirection = _target.forward; _targetHeightAdjustmentDistance = _targetPosition.y; _preTargetHeight = _targetHeightAdjustmentDistance; Collision.Initialize(Camera.main); }
private void Start() { input = gameObject.GetComponent <PlayerInputController>(); // Grab the controller object from our object. controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground. lookDirection = transform.forward; // Set our currentState to idle on startup. currentState = PlayerStates.Idle; }
void Start () { // Put any code here you want to run ONCE, when the object is initialized input = gameObject.GetComponent<PlayerInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent<SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
void Start() { player = GameControl.instance.player; input = player.GetComponent<PlayerInputController>(); machine = player.GetComponent<PlayerMachine>(); controller = player.GetComponent<SuperCharacterController>(); target = player.transform; // Set the look direction based on the initial rotation of the player lookDirection = Quaternion.AngleAxis(machine.InitialRotation, controller.up) * Vector3.forward; distance = (minDistance + maxDistance) / 2; }
// Use this for initialization void Start() { if( Instance == null ){ Instance = this; }else if( Instance != null ){ Destroy(this); } input = PlayerTarget.GetComponent<PlayerInputController>(); machine = PlayerTarget.GetComponent<PlayerMachine>(); controller = PlayerTarget.GetComponent<SuperCharacterController>(); target = PlayerTarget.transform; onSpin = false; continueRotation = 1.0f; }
private void Start() { superCharacterController = GetComponent <SuperCharacterController>(); warriorController = GetComponent <WarriorControllerFREE>(); warriorInputController = GetComponent <WarriorInputControllerFREE>(); animator = GetComponentInChildren <Animator>(); rb = GetComponent <Rigidbody>(); if (rb != null) { //Set restraints on startup if using Rigidbody. rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } //Set currentState to idle on startup. currentState = WarriorState.Idle; warriorState = WarriorState.Idle; SwitchCollisionOn(); }
void Awake() { superCharacterController = GetComponent <SuperCharacterController>(); rpgCharacterController = GetComponent <RPGCharacterControllerFREE>(); rpgCharacterInputController = GetComponent <RPGCharacterInputController>(); navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>(); animator = GetComponentInChildren <Animator>(); rb = GetComponent <Rigidbody>(); if (rb != null) { //Set restraints on startup if using Rigidbody. rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } //Set currentState to idle on startup. currentState = RPGCharacterState.Idle; rpgCharacterState = RPGCharacterState.Idle; }
void Start() { currentCameraPosition = InitialPosition; target = GameObject.FindWithTag("Player").transform; input = target.GetComponent <MarioInput>(); mario = target.GetComponent <MarioMachine>(); controller = target.GetComponent <SuperCharacterController>(); currentRotationHorizontal = mario.InitialRotation; var height = Mathf.Lerp(MinHeight, MaxHeight, currentCameraPosition); verticalPosition = Math3d.ProjectPointOnLine(Vector3.zero, controller.up, target.position + height * controller.up); StartCoroutine(ConstantShake()); }
void Start() { FireOrigin.Stop(); // Put any code here you want to run ONCE, when the object is initialized inputDecay = 0f; input = gameObject.GetComponent <PlayerInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; animator = gameObject.GetComponent <Animator> (); defaultGravity = Gravity; }
protected virtual void Start() { Alive = true; controller = gameObject.GetComponent <SuperCharacterController>(); lookDirection = transform.forward; if (RandomDirection) { lookDirection = Quaternion.AngleAxis(UnityEngine.Random.Range(0f, 360f), transform.up) * lookDirection; } anim = AnimatedMesh.GetComponent <Animation>(); playerLayer = 1 << LayerMask.NameToLayer("Player"); if (!target) { target = GameObject.FindWithTag("Player").transform; } }
void Start() { Cursor.visible = false; input = gameObject.GetComponent <PlayerInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; originalWalkspeed = WalkSpeed; extraWallRunSpeed = WalkSpeed * 1.75f; extraWallRunJumpAcceleration = JumpAcceleration * 2f; originalWalkAcceleration = WalkAcceleration; originalJumpAcceleration = JumpAcceleration; reducedJumpAcceleration = JumpAcceleration / 10f; originalGravity = Gravity; wallRunGravity = originalGravity / 2; }
void Start() { player = FindObjectOfType <SuperCharacterController> (); inputs = FindObjectOfType <PlayerInputController> (); collDetec = FindObjectOfType <ColDetector> (); }
void Start() { player = FindObjectOfType <SuperCharacterController> (); }
public SuperGround(LayerMask walkable, SuperCharacterController controller, QueryTriggerInteraction triggerInteraction) { this.walkable = walkable; this.controller = controller; this.triggerInteraction = triggerInteraction; }
void Start() { target = mario.transform; controller = mario.GetComponent <SuperCharacterController>(); projector = GetComponent <Projector>(); }
public SuperGround(LayerMask walkable, SuperCharacterController controller) { this.walkable = walkable; this.controller = controller; }
void Start() { controller = gameObject.GetComponent<SuperCharacterController>(); input = gameObject.GetComponent<PlayerInputController>(); cam = GameControl.instance.mainCamera.GetComponent<PlayerCamera>(); anim = AnimatedMesh.GetComponent<Animator>(); // Our character's current facing direction, planar to the ground artForwardDirection = Quaternion.AngleAxis(InitialRotation, controller.up) * Vector3.forward; artUpDirection = controller.up; AnimatedMesh.rotation = Quaternion.LookRotation (artForwardDirection, artUpDirection); // Set our currentState to idle on startup currentState = PlayerStates.Idle; RunSpeed = MoveSpeed * 0.4f; RunSmokeEffect.enableEmission = false; doubleJump = false; }
private void Awake() { // Get SuperCharacterController. superCharacterController = GetComponent <SuperCharacterController>(); // Get Movement Controller. warriorMovementController = GetComponent <WarriorMovementController>(); // Add Timing Controllers. warriorTiming = gameObject.AddComponent <WarriorTiming>(); warriorTiming.warriorController = this; // Add IKHands. ikHands = GetComponentInChildren <IKHands>(); if (ikHands != null) { if (warrior == Warrior.TwoHanded || warrior == Warrior.Hammer || warrior == Warrior.Crossbow || warrior == Warrior.Spearman) { ikHands.canBeUsed = true; ikHands.BlendIK(true, 0, 0.25f); } } // Setup Animator, add AnimationEvents script. animator = GetComponentInChildren <Animator>(); if (animator == null) { Debug.LogError("ERROR: There is no Animator component for character."); Debug.Break(); } else { animator.gameObject.AddComponent <WarriorCharacterAnimatorEvents>(); animator.GetComponent <WarriorCharacterAnimatorEvents>().warriorController = this; animator.gameObject.AddComponent <AnimatorParentMove>(); animator.GetComponent <AnimatorParentMove>().animator = animator; animator.GetComponent <AnimatorParentMove>().warriorController = this; animator.updateMode = AnimatorUpdateMode.AnimatePhysics; animator.cullingMode = AnimatorCullingMode.CullUpdateTransforms; } // Determine input source. warriorInputController = GetComponent <WarriorInputController>(); if (warriorInputController != null) { useInputSystem = false; } else { warriorInputSystemController = GetComponent <WarriorInputSystemController>(); if (warriorInputSystemController != null) { useInputSystem = true; } else { Debug.LogError("No inputs!"); } } // Setup Rigidbody. rb = GetComponent <Rigidbody>(); if (rb != null) { rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } currentState = WarriorState.Idle; }
void Start() { // Put any code here you want to run ONCE, when the object is initialized weaponList = new IWeapon[]{ new NetBehaviour( gameObject,hittable ), new SwordBehaviour(gameObject,hittable) }; mWeapon = weaponList[0]; input = gameObject.GetComponent<PlayerInputController>(); anims = new AnimState[]{ new idleAnimState(),new runAnimState(),new jumpAnimState(),new doubleJumpAnimState(),new climbAnimState(),new fallAnimState() }; currentAnimState = anims[0]; // Grab the controller object from our object controller = gameObject.GetComponent<SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
public SuperGround(LayerMask walkable, SuperCharacterController controller) { this.walkable = walkable; this.controller = controller; }
void Start() { sCC = GetComponent <SuperCharacterController>(); }
public SuperGround(LayerMask walkable, SuperCharacterController controller, QueryTriggerInteraction triggerInteraction) { this.walkable = walkable; this.controller = controller; this.triggerInteraction = triggerInteraction; }