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; }
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); }
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) { }
public void SetUpContactDelegates(OnCollision onCollision, OnSeparation onSeparation) { this.onCollision = onCollision; this.onSeparation = onSeparation; }
internal void RaiseOnSeparation(Fixture fixtureA, Fixture fixtureB) { OnSeparation?.Invoke(fixtureA, fixtureB); }
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"); } }