Esempio n. 1
0
        public PlayerPhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
            : base(owner, world, position, width, height, density, onCollision, onSeparation)
        {
            // Load resources
            ConfigFile configFile = PhysicsSystem.GetPhysicsConfigFile();
            runSpeed = configFile.SettingGroups[physicsSettings].Settings["runSpeed"].GetValueAsFloat();
            runAirControlSpeed = configFile.SettingGroups[physicsSettings].Settings["airControlSpeed"].GetValueAsFloat();
            jumpImpulse = configFile.SettingGroups[physicsSettings].Settings["jumpImpulse"].GetValueAsFloat();
            wallJumpImpulse = configFile.SettingGroups[physicsSettings].Settings["wallJumpImpulse"].GetValueAsFloat();
            airControlAbility = configFile.SettingGroups[physicsSettings].Settings["airControlAbility"].GetValueAsFloat();
            terminalVelocity = configFile.SettingGroups[physicsSettings].Settings["terminalVelocity"].GetValueAsFloat();
            slideTerminalVelocity = configFile.SettingGroups[physicsSettings].Settings["slideTerminalVelocity"].GetValueAsFloat();
            dashMultiplier = configFile.SettingGroups[physicsSettings].Settings["dashMultiplier"].GetValueAsFloat();

            wallSlideEnabled = false;
            onGroundTimer = new Timer();
            onLeftWallTimer = new Timer();
            onRightWallTimer = new Timer();
            enableOnGroundDelay = true;
            enableOnLeftWallDelay = true;
            enableOnRightWallDelay = true;

            moveSpeed = runSpeed;
            airControlSpeed = runAirControlSpeed;
        }
Esempio n. 2
0
        public PhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
            : base(owner, world, position, width, height, density)
        {
            OnRightWall = false;
            OnLeftWall = false;
            CharOnHead = false;
            onGroundInt = 0;
            onGroundDelay = false;
            onGroundRay = false;
            RayCastIncludesDeath = true;

            SetUpContactDelegates(onCollision, onSeparation);
        }
Esempio n. 3
0
 public EnemyPhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
     : base(owner, world, position, width, height, density, onCollision, onSeparation)
 {
 }
Esempio n. 4
0
 public void SetUpContactDelegates(OnCollision onCollision, OnSeparation onSeparation)
 {
     this.onCollision  = onCollision;
     this.onSeparation = onSeparation;
 }
Esempio n. 5
0
        public PhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
            : base(owner, world, position, width, height, density)
        {
            OnRightWall          = false;
            OnLeftWall           = false;
            CharOnHead           = false;
            onGroundInt          = 0;
            onGroundDelay        = false;
            onGroundRay          = false;
            RayCastIncludesDeath = true;

            SetUpContactDelegates(onCollision, onSeparation);
        }
Esempio n. 6
0
        public PlayerPhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
            : base(owner, world, position, width, height, density, onCollision, onSeparation)
        {
            // Load resources
            ConfigFile configFile = PhysicsSystem.GetPhysicsConfigFile();

            runSpeed              = configFile.SettingGroups[physicsSettings].Settings["runSpeed"].GetValueAsFloat();
            runAirControlSpeed    = configFile.SettingGroups[physicsSettings].Settings["airControlSpeed"].GetValueAsFloat();
            jumpImpulse           = configFile.SettingGroups[physicsSettings].Settings["jumpImpulse"].GetValueAsFloat();
            wallJumpImpulse       = configFile.SettingGroups[physicsSettings].Settings["wallJumpImpulse"].GetValueAsFloat();
            airControlAbility     = configFile.SettingGroups[physicsSettings].Settings["airControlAbility"].GetValueAsFloat();
            terminalVelocity      = configFile.SettingGroups[physicsSettings].Settings["terminalVelocity"].GetValueAsFloat();
            slideTerminalVelocity = configFile.SettingGroups[physicsSettings].Settings["slideTerminalVelocity"].GetValueAsFloat();
            dashMultiplier        = configFile.SettingGroups[physicsSettings].Settings["dashMultiplier"].GetValueAsFloat();

            wallSlideEnabled       = false;
            onGroundTimer          = new Timer();
            onLeftWallTimer        = new Timer();
            onRightWallTimer       = new Timer();
            enableOnGroundDelay    = true;
            enableOnLeftWallDelay  = true;
            enableOnRightWallDelay = true;

            moveSpeed       = runSpeed;
            airControlSpeed = runAirControlSpeed;
        }
Esempio n. 7
0
 internal void RaiseOnSeparation(Fixture fixtureA, Fixture fixtureB)
 {
     OnSeparation?.Invoke(fixtureA, fixtureB);
 }
Esempio n. 8
0
 public void SetUpContactDelegates(OnCollision onCollision, OnSeparation onSeparation)
 {
     this.onCollision = onCollision;
     this.onSeparation = onSeparation;
 }
Esempio n. 9
0
        public const float defaultMaxMotorTorque = 0.3f; //set this higher for some more juice

        public CompositePhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
            : base(owner, world, position, width, height, density, onCollision, onSeparation)
        {
            if (width > height)
            {
                throw new Exception("Error width > height: can't make character because wheel would stick out of body");
            }
        }
Esempio n. 10
0
 public EnemyPhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
     : base(owner, world, position, width, height, density, onCollision, onSeparation)
 {
 }