void Start() { enterFuncs = new eeDel[] { this.EnterStanding, this.EnterSneaking, this.EnterCrouching, this.EnterJumping, this.EnterFalling }; exitFuncs = new eeDel[] { this.ExitStanding, this.ExitSneaking, this.ExitCrouching, this.ExitJumping, this.ExitFalling }; updateFuncs = new uDel[] { this.UpdateStanding, this.UpdateSneaking, this.UpdateCrouching, this.UpdateJumping, this.UpdateFalling }; rb = GetComponent <Rigidbody>(); anim = GetComponentInChildren <Animator>(); controls = new PlayerControls(); controls.Enable(); controls.Player.Jump.started += OnJumpStarted; controls.Player.Sneak.started += OnSneakStarted; controls.Player.Sneak.canceled += OnSneakCanceled; controls.Player.Crouch.started += OnCrouchStarted; controls.Player.Crouch.canceled += OnCrouchCanceled; PlayerIK ik = GetComponentInChildren <PlayerIK>(); if (ik) { ik.onFootHitGround += OnFootHitGround; } soundManager = SoundManager.Get(); instantCam = GetComponentInChildren <InstantCamera>(); }
public void SetFirstPersonCharacter(GameObject obj) { _characterP1 = obj; _boneRigging.SetFirstPersonCharacter(obj); if (null != obj) { _firstPlayerIk = obj.GetComponent <PlayerIK>(); } }
public void SetThirdPersonCharacter(GameObject obj) { _characterP3 = obj; _boneRigging.SetThirdPersonCharacter(obj); _followRot.SetThirdPersonCharacter(obj); _weaponRot.SetThirdPersonCharacter(obj); if (obj != null) { _thirdPlayerIk = obj.GetComponent <PlayerIK>(); } }
// Use this for initialization void Start() { m_Animator = GetComponent<Animator>(); m_PlayerIK = GetComponent<PlayerIK>(); //-- give the gameplay manager a reference to the player controller GameplayManager.Instance.RegisterPlayerController(this); //-- register for input events touchInput.Swipe += TouchInput_Swipe; }
private void GetP3Bones(GameObject obj) { if (null == obj) { return; } _spineP3 = BoneMount.FindChildBone(obj, BoneName.CharacterSpineName); //"Bip01 Spine"); _spine1P3 = BoneMount.FindChildBone(obj, BoneName.CharacterSpine1Name); // "Bip01 Spine1"); _pelvisP3 = BoneMount.FindChildBone(obj, BoneName.CharacterBipPelvisName); //"Bip01 Pelvis"); _ikControllerP3 = obj.GetComponent <PlayerIK>(); _ikControllerP3.SetIKGoal(AvatarIKGoal.LeftHand); }
private void GetP1Bones(GameObject obj) { if (null == obj) { return; } _viewPointP1 = BoneMount.FindChildBone(obj, BoneName.ViewPoint); _baseLocatorP1 = BoneMount.FindChildBone(obj, BoneName.FirstPersonHandLocator); _directionLocatorP1 = BoneMount.FindChildBone(obj, BoneName.FirstPersonSubHandLocator); _cameraLocatorP1 = BoneMount.FindChildBone(obj, BoneName.FirstPersonCameraLocator); _rightHandP1 = BoneMount.FindChildBone(obj, BoneName.CharacterRightHandName); _leftHandP1 = BoneMount.FindChildBone(obj, BoneName.CharacterLeftHandName); _ikControllerP1 = obj.GetComponent <PlayerIK>(); _ikControllerP1.SetIKGoal(AvatarIKGoal.LeftHand); }
void Awake() { Transform = transform.parent.parent; Anim = Transform.GetComponent <AnimationScript>(); Rigidbody = Transform.GetComponent <Rigidbody2D>(); MovementAllowed = true; StandingCollider = Transform.GetComponent <BoxCollider2D>(); CrouchedCollider = Transform.GetComponents <BoxCollider2D>()[1]; MovementState = new MovementState(StandingCollider.bounds.extents); _iks = new PlayerIK(MovementState); _movement = new MovementHandler(this); _climbHandler = new ClimbHandler(this); Interaction = new Interaction(); }