public override bool Evaluate(uint frame, uint endFrame,
                                      CAF.Entities.EntityManager controller, AttackEventVariables variables)
        {
            TUF.Entities.EntityPhysicsManager physicsManager = (TUF.Entities.EntityPhysicsManager)controller.PhysicsManager;

            Vector3 f = Vector3.zero;

            if (xzForce)
            {
                f.x = variables.floatVars[0];
                f.z = variables.floatVars[1];
            }
            if (yForce)
            {
                f.y = variables.floatVars[2];
            }

            f = controller.GetVisualBasedDirection(f);

            if (yForce)
            {
                physicsManager.forceGravity.y += f.y;
            }
            if (xzForce)
            {
                f.y = 0;
                physicsManager.forceMovement += f;
            }
            return(false);
        }
 public override bool Evaluate(uint frame, uint endFrame,
                               CAF.Entities.EntityManager controller, AttackEventVariables variables)
 {
     TUF.Entities.EntityPhysicsManager physicsManager = (TUF.Entities.EntityPhysicsManager)controller.PhysicsManager;
     physicsManager.forceMovement = Vector3.ClampMagnitude(physicsManager.forceMovement,
                                                           variables.floatVars[0]);
     return(false);
 }
 public override bool Evaluate(uint frame, uint endFrame,
                               CAF.Entities.EntityManager controller, AttackEventVariables variables)
 {
     TUF.Entities.EntityPhysicsManager physicsManager = (TUF.Entities.EntityPhysicsManager)controller.PhysicsManager;
     physicsManager.forceGravity.y = Mathf.Clamp(physicsManager.forceGravity.y,
                                                 variables.floatVars[0], variables.floatVars[1]);
     return(false);
 }
Ejemplo n.º 4
0
        public override bool Evaluate(uint frame, uint endFrame,
                                      CAF.Entities.EntityManager controller, AttackEventVariables variables)
        {
            TUF.Entities.EntityPhysicsManager physicsManager = (TUF.Entities.EntityPhysicsManager)controller.PhysicsManager;

            Vector3 f       = Vector3.zero;
            float   percent = (float)frame / (float)endFrame;

            if (xForce)
            {
                f.x = variables.curveVars[0].Evaluate(percent)
                      * variables.floatVars[0];
            }
            if (yForce)
            {
                f.y = variables.curveVars[1].Evaluate(percent)
                      * variables.floatVars[1];
            }
            if (zForce)
            {
                f.z = variables.curveVars[2].Evaluate(percent)
                      * variables.floatVars[2];
            }

            float tempY = f.y;

            f = controller.GetVisualBasedDirection(f);

            // Set Mode
            if (variables.intVars[0] == 0)
            {
                if (yForce)
                {
                    physicsManager.forceGravity.y = tempY;
                }
                if (xForce || zForce)
                {
                    f.y = 0;
                    physicsManager.forceMovement = f;
                }
            }
            else
            {
                if (yForce)
                {
                    physicsManager.forceGravity.y += f.y;
                }
                if (xForce || zForce)
                {
                    f.y = 0;
                    physicsManager.forceMovement += f;
                }
            }
            return(false);
        }
        public override bool Evaluate(uint frame, uint endFrame,
                                      CAF.Entities.EntityManager controller, AttackEventVariables variables)
        {
            TUF.Entities.EntityPhysicsManager physicsManager = (TUF.Entities.EntityPhysicsManager)controller.PhysicsManager;

            if (xzFriction)
            {
                physicsManager.ApplyMovementFriction(variables.floatVars[0]);
            }
            if (yFriction)
            {
                physicsManager.ApplyGravityFriction(variables.floatVars[0]);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public override bool Evaluate(uint frame, uint endFrame,
                                      CAF.Entities.EntityManager controller, AttackEventVariables variables)
        {
            TUF.Entities.EntityPhysicsManager physicsManager = (TUF.Entities.EntityPhysicsManager)controller.PhysicsManager;

            if (controller.IsGrounded)
            {
                physicsManager.forceGravity = Vector3.zero;
                return(false);
            }
            float percent = (float)frame / (float)endFrame;

            float gravity = ((TUF.Entities.EntityManager)controller).EntityStats.gravity;

            if (!useEntityGravity)
            {
                gravity = variables.curveVars[0].Evaluate(percent)
                          * variables.floatVars[0];
            }

            float gravityScale = physicsManager.GravityScale;

            if (!useEntityGravityScale)
            {
                gravityScale = variables.curveVars[1].Evaluate(percent)
                               * variables.floatVars[1];
            }

            float maxFallSpeed = ((TUF.Entities.EntityManager)controller).EntityStats.maxFallSpeed;

            if (!useEntityMaxFallSpeed)
            {
                maxFallSpeed = variables.curveVars[2].Evaluate(percent)
                               * variables.floatVars[2];
            }

            physicsManager.HandleGravity(maxFallSpeed, gravity, gravityScale);
            return(false);
        }
        public override HitReaction Hurt(HurtInfoBase hurtInfoBase)
        {
            EntityPhysicsManager physicsManager = (EntityPhysicsManager)Controller.PhysicsManager;
            HurtInfo3D           hurtInfo       = (HurtInfo3D)hurtInfoBase;

            HitReaction hitReaction = new HitReaction();

            hitReaction.reactionType = HitReactionType.Hit;

            // Check if should hit grounded/aerial opponent.
            if (hurtInfo.hitInfo.groundOnly && !Controller.IsGrounded ||
                hurtInfo.hitInfo.airOnly && Controller.IsGrounded)
            {
                hitReaction.reactionType = HitReactionType.Avoided;
                return(hitReaction);
            }

            HitInfo hitInfo = (HitInfo)hurtInfo.hitInfo;

            // Got hit.
            LastHitBy = hurtInfo.hitInfo;
            SetHitStop(hurtInfo.hitInfo.hitstop);
            SetHitStun(hurtInfo.hitInfo.hitstun);
            ((EntityManager)manager).healthManager.Hurt(hitInfo.damageOnHit);

            // Convert forces the attacker-based forward direction.
            switch (hitInfo.forceType)
            {
            case HitboxForceType.SET:
                Vector3 baseForce = hitInfo.opponentForceDir * hitInfo.opponentForceMagnitude;
                Vector3 forces    = (hurtInfo.forward * baseForce.z + hurtInfo.right * baseForce.x);
                forces.y = baseForce.y;
                physicsManager.forceGravity.y = baseForce.y;
                forces.y = 0;
                physicsManager.forceMovement = forces;
                break;

            case HitboxForceType.PULL:
                Vector3 dir = transform.position - hurtInfo.center;
                if (!hitInfo.forceIncludeYForce)
                {
                    dir.y = 0;
                }
                Vector3 forceDir = Vector3.ClampMagnitude((dir) * hitInfo.opponentForceMagnitude, hitInfo.opponentMaxMagnitude);
                float   yForce   = forceDir.y;
                forceDir.y = 0;
                if (hitInfo.forceIncludeYForce)
                {
                    physicsManager.forceGravity.y = yForce;
                }
                physicsManager.forceMovement = forceDir;
                break;
            }

            if (physicsManager.forceGravity.y > 0)
            {
                Controller.IsGrounded = false;
            }

            // Change state to the correct one.
            if (Controller.IsGrounded && hitInfo.groundBounces)
            {
                Controller.StateManager.ChangeState((int)EntityStates.GROUND_BOUNCE);
            }
            else if (hitInfo.causesTumble)
            {
                Controller.StateManager.ChangeState((int)EntityStates.TUMBLE);
            }
            else
            {
                Controller.StateManager.ChangeState((int)(Controller.IsGrounded ? EntityStates.FLINCH : EntityStates.FLINCH_AIR));
            }

            return(hitReaction);
        }