public override void InitStates() { base.InitStates(); standingState = Instantiate(standingState); runningState = Instantiate(runningState); aerialState = Instantiate(aerialState); perchedState = Instantiate(perchedState); wallJumpState = Instantiate(wallJumpState); stunnedState = Instantiate(stunnedState); knockedOutState = Instantiate(knockedOutState); chargeNormalAttack = Instantiate(chargeNormalAttack); chargeNormalAttack.InitStates(); /*chargeUpAttack = Instantiate(chargeUpAttack); * chargeUpAttack.InitStates();*/ chargeDownAttack = Instantiate(chargeDownAttack); chargeDownAttack.InitStates(); hitStunState = Instantiate(hitStunState); }
protected override void link() { base.link(); var controlsType = this.PlayerId.GetPlayerKeyedType(typeof(PlayerControls <>)); playerControls = Scope.ServiceProvider.GetService(controlsType) as PlayerControls; rigidBody = Owner.getElement(RigidBodyName) as RigidBody; if (rigidBody == null) { blacklist("Cannot find player rigid body '{0}'", RigidBodyName); } node = Owner.getElement(NodeName) as SceneNodeElement; if (node == null) { blacklist("Cannot find player node '{0}'"); } entity = node.getNodeObject(EntityName) as Entity; if (entity == null) { blacklist("Cannot find entity '{0}' on node '{1}'", EntityName, NodeName); } runBase = entity.getAnimationState(RunBaseAnimationName); if (runBase == null) { blacklist("Cannot find animation for run base '{0}' on entity '{1}'", RunBaseAnimationName, EntityName); } runTop = entity.getAnimationState(RunTopAnimationName); if (runTop == null) { blacklist("Cannot find animation for run top '{0}' on entity '{1}'", RunTopAnimationName, EntityName); } idleBase = entity.getAnimationState(IdleBaseAnimationName); if (idleBase == null) { blacklist("Cannot find animation for idle base '{0}' on entity '{1}'", IdleBaseAnimationName, EntityName); } idleTop = entity.getAnimationState(IdleTopAnimationName); if (idleTop == null) { blacklist("Cannot find animation for idle top '{0}' on entity '{1}'", IdleTopAnimationName, EntityName); } jumpStart = entity.getAnimationState(JumpStartAnimationName); if (jumpStart == null) { blacklist("Cannot find animation for jump start '{0}' on entity '{1}'", JumpStartAnimationName, EntityName); } jumpLoop = entity.getAnimationState(JumpLoopAnimationName); if (jumpLoop == null) { blacklist("Cannot find animation for jump loop '{0}' on entity '{1}'", JumpLoopAnimationName, EntityName); } jumpEnd = entity.getAnimationState(JumpLoopAnimationName); if (jumpEnd == null) { blacklist("Cannot find animation for jump end '{0}' on entity '{1}'", JumpEndAnimationName, EntityName); } groundRayCenter = new ClosestRayResultCallback(Owner.Translation, Owner.Translation + Vector3.Down); groundRayCenter.CollisionFilterMask = ~2; groundRayFront = new ClosestRayResultCallback(Owner.Translation + frontRearRayOffset, Owner.Translation + Vector3.Down); groundRayFront.CollisionFilterMask = ~2; groundRayRear = new ClosestRayResultCallback(Owner.Translation - frontRearRayOffset, Owner.Translation + Vector3.Down); groundRayRear.CollisionFilterMask = ~2; rigidBody.Scene.Tick += Scene_Tick; runningState = new RunningPlayerState(); runningState.link(this); idleState = new IdlePlayerState(); idleState.link(this); jumpUpState = new JumpUpPlayerState(); jumpUpState.link(this); fallingState = new FallingPlayerState(); fallingState.link(this); CurrentState = idleState; addToDebugDrawing(); }