// public override bool IsRiding(Solid solid) // { // return Bottom == solid.Top; // } // public void NodeHandler(System.Xml.XmlNode entity) // { // } public override void _PhysicsProcess(float delta) { base._PhysicsProcess(delta); InputController.Update(); // if(Keyboard.Space.Pressed) // { // Console.WriteLine(player_controller.current_state.ToString()); // } PlayerStateController.Update(); MovementInfo.Update(); if (InputController.Select()) { Abilities.GiveAllAbilities(); } UpdateCamera(); if (MovementInfo.LeftBox) { foreach (PhysicsBody2D body in BoxL.GetOverlappingBodies().OfType <PhysicsBody2D>().Where(x => x.IsInGroup("enemy"))) { body.ShapeOwnerSetDisabled(body.ShapeFindOwner(0), true); body.QueueFree(); } } if (MovementInfo.RightBox) { foreach (PhysicsBody2D body in BoxR.GetOverlappingBodies().OfType <PhysicsBody2D>().Where(x => x.IsInGroup("enemy"))) { body.ShapeOwnerSetDisabled(body.ShapeFindOwner(0), true); body.QueueFree(); } } if (MovementInfo.BottomBox) { foreach (PhysicsBody2D body in BoxB.GetOverlappingBodies().OfType <PhysicsBody2D>().Where(x => x.IsInGroup("enemy"))) { body.ShapeOwnerSetDisabled(body.ShapeFindOwner(0), true); body.QueueFree(); } } }
public void Update() { if (EXP != 0) { RefreshLevel(); } if (BulletAmount == 0 && Time.time - ReloadStartTime > GunReloadInterval) { Reload(); } if (Time.time > PeaceStartTime + WaitNoHealingTime) { HPChange(Time.deltaTime * WaitHPHealingSpeed); MPChange(Time.deltaTime * WaitMPHealingSpeed); } Controller.Update(); HealthBoard.GetComponent <TextMesh>().text = "Player Lv." + Level + Environment.NewLine + Mathf.FloorToInt(HP) + "/" + Mathf.FloorToInt(MaxHP) + Environment.NewLine + Mathf.FloorToInt(MP) + "/" + Mathf.FloorToInt(MaxMP) + Environment.NewLine + BulletAmount + "/" + GunBulletAmount; }
void Update() { Debug.Log("Current state: " + _currentState); _playerState.Update(); }
// public override bool IsRiding(Solid solid) // { // return Bottom == solid.Top; // } // public void NodeHandler(System.Xml.XmlNode entity) // { // } public override void _PhysicsProcess(float delta) { base._PhysicsProcess(delta); InputController.Update(); // if(Keyboard.Space.Pressed) // { // Console.WriteLine(player_controller.current_state.ToString()); // } PlayerStateController.Update(); MovementInfo.Update(); if (InputController.Select()) { _overlord.Call("Reset"); } if (MovementInfo.LeftBox) { foreach (PhysicsBody2D body in BoxL.GetOverlappingBodies().OfType <PhysicsBody2D>().Where(x => x.IsInGroup(HitGroups.Enemy))) { body.ShapeOwnerSetDisabled(body.ShapeFindOwner(0), true); body.QueueFree(); _camera.Call("Shake", .1f, 100, 10); Overlord.OwlOverlord.PlaySound("Hit4", Position); // if (body.HasMethod("OnDamage")) // body.Call("OnDamage"); // else if (body.HasMethod("on_damage")) // body.Call("on_damage"); } foreach (var area in BoxL.GetOverlappingAreas().OfType <Area2D>().Where(x => x.IsInGroup(HitGroups.Bullet))) { _camera.Call("Shake", .1f, 100, 10); area.Call("Deflect"); } } if (MovementInfo.RightBox) { foreach (PhysicsBody2D body in BoxR.GetOverlappingBodies().OfType <PhysicsBody2D>().Where(x => x.IsInGroup(HitGroups.Enemy))) { body.ShapeOwnerSetDisabled(body.ShapeFindOwner(0), true); body.QueueFree(); _camera.Call("Shake", .1f, 100, 10); Overlord.OwlOverlord.PlaySound("Hit4", Position); } foreach (var area in BoxR.GetOverlappingAreas().OfType <Area2D>().Where(x => x.IsInGroup(HitGroups.Bullet))) { _camera.Call("Shake", .1f, 100, 10); area.Call("Deflect"); } } if (MovementInfo.BottomBox) { foreach (PhysicsBody2D body in BoxB.GetOverlappingBodies().OfType <PhysicsBody2D>().Where(x => x.IsInGroup(HitGroups.Enemy))) { body.ShapeOwnerSetDisabled(body.ShapeFindOwner(0), true); body.QueueFree(); _camera.Call("Shake", .1f, 100, 10); Overlord.OwlOverlord.PlaySound("Hit4", Position); } foreach (var area in BoxB.GetOverlappingAreas().OfType <Area2D>().Where(x => x.IsInGroup(HitGroups.Bullet))) { _camera.Call("Shake", .1f, 100, 10); area.Call("Deflect"); } } invulnerabilityFrames = Math.Max(--invulnerabilityFrames, 0); }
private void LateUpdate() { //Update our state - THIS NEEDS TO BE IN LATE UPDATE TO AVOID RACE CONDITIONS with playerInputController playerStateController.Update(); }