public Blueprint(int width, int height) { this.Width = width; this.Height = height; var numTiles = width * height; this.WallComp = new WallComponent(); WallComp.blueprint = this; this.FloorComp = new FloorComponent(); FloorComp.blueprint = this; RoomColors = new Color[65536]; this.WallsAt = new List <int> [Stories]; this.Walls = new WallTile[Stories][]; this.RoomMap = new uint[Stories][]; this.Floors = new FloorTile[Stories][]; for (int i = 0; i < Stories; i++) { this.WallsAt[i] = new List <int>(); this.Walls[i] = new WallTile[numTiles]; this.Floors[i] = new FloorTile[numTiles]; } }
public Blueprint(int width, int height) { this.Width = width; this.Height = height; var numTiles = width * height; this.WallComp = new WallComponent(); WallComp.blueprint = this; this.RoofComp = new RoofComponent(this); this.FloorGeom = new _3DFloorGeometry(this); if (WorldConfig.Current.Shadow3D || FSOEnvironment.Enable3D) { this.WCRC = new WallComponentRC(); WCRC.blueprint = this; } RoomColors = new Color[65536]; this.WallsAt = new List <int> [Stories]; this.Walls = new WallTile[Stories][]; this.RoomMap = new uint[Stories][]; this.Floors = new FloorTile[Stories][]; for (int i = 0; i < Stories; i++) { this.WallsAt[i] = new List <int>(); this.Walls[i] = new WallTile[numTiles]; this.Floors[i] = new FloorTile[numTiles]; } this.Cutaway = new bool[numTiles]; this.Weather = new WeatherController(this); }
public void CloseWindow() { FindObjectOfType <MapBuilder>().OpenWindowMap.Remove(_component); _component = null; Debug.Log("Closing window!"); Destroy(gameObject); }
public static GameObject CreateFromData(WallComponent component) { var go = Instantiate(Resources.Load <GameObject>("Prefabs/UI/Windows/Editor/WallMapModelEditor"), GameObject.Find("GlobalCanvas").transform); go.GetComponent <WallMapModelEditor>().ConfigureFromData(component); return(go); }
public void LoadHouse(HouseData data) { _FloorList = new List <FloorComponent>(); _FloorLookup = new FloorComponent[2, data.Size, data.Size]; foreach (var floor in data.World.Floors) { var floorComponent = new FloorComponent() { Position = new Microsoft.Xna.Framework.Point(floor.X, floor.Y), Level = floor.Level, FloorStyle = floor.Value }; _FloorLookup[floor.Level, floor.X, floor.Y] = floorComponent; _FloorList.Add(floorComponent); } _WallList = new List <WallComponent>(); _WallLookup = new WallComponent[2, data.Size, data.Size]; foreach (var wall in data.World.Walls) { var wallComponent = new WallComponent(wall) { Position = new Microsoft.Xna.Framework.Point(wall.X, wall.Y), Level = wall.Level }; _WallList.Add(wallComponent); _WallLookup[wall.Level, wall.X, wall.Y] = wallComponent; } }
public void Apply(IEntity entity) { var wallComponent = new WallComponent(); wallComponent.Health.Value = DefaultWallHealth; entity.AddComponents(wallComponent, new ViewComponent(), new RandomlyPlacedComponent()); }
// Saving the way centipede head have done and // moving the tail along this path private IEnumerator MoveCentipede() { if (_fieldController == null) { yield break; } WallComponent wc = _fieldController.GetNearestPoint(_thisTransform.position); _thisTransform.position = wc.Position; WallComponent newPoint = _fieldController.GetNextPointInDirection(wc, ref _direction); AddNewWayPoint(newPoint.Position); MoveTail(); while (true) { newPoint = _fieldController.GetNextPointInDirection(newPoint, ref _direction); AddNewWayPoint(newPoint.Position); yield return(StartCoroutine (MoveInterpolation(_thisTransform, newPoint.Position, positionUpdateTime))); _thisTransform.position = newPoint.Position; MoveTail(); } }
public void ConfigureFromData(WallComponent component) { _component = component; CloseButton.onClick.AddListener(CloseWindow); IdentifierText.text = component.WallModel.IdName; PositionText.text = component.gameObject.transform.position.ToString(); }
// Creating empty wall on the nearest point to this position public void CreateEmptyWall(Vector3 position) { GameObject instance = Instantiate(_emptyWallPrefab); WallComponent pointWc = GetNearestPoint(position); pointWc.SetValue(false); instance.transform.position = pointWc.Position; instance.transform.localScale = GlobalVariables.CELL_SIZE * 0.5f; FieldMatrix.SetValueTo(pointWc.FieldCoordinates.x, pointWc.FieldCoordinates.y, pointWc); }
// Get nearest field point to this position public WallComponent GetNearestPoint(Vector2 position) { IEnumerable <WallComponent> values = FieldMatrix.Field.Cast <WallComponent>(); WallComponent nearestPoint = values.Where(v => v != null).Select(v => new { originalObj = v, v.Position, v.FieldCoordinates, Distance = Vector2.Distance(v.Position, position) }).OrderBy(v => v.Distance).First().originalObj; return(nearestPoint); }
/// <summary> /// Creates a border rectangle /// </summary> /// <param name="pos"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="side"></param> /// <returns></returns> public int CreateBorderRecs(Vector2 pos, int width, int height, Wall side) { PositionComponent PC = new PositionComponent(pos); CollisionRectangleComponent CRC = new CollisionRectangleComponent(new Rectangle((int)pos.X, (int)pos.Y, width, height)); CollisionComponent CC = new CollisionComponent(false); WallComponent wc = new WallComponent(side); int id = ComponentManager.Instance.CreateID(); ComponentManager.Instance.AddComponentToEntity(id, PC); ComponentManager.Instance.AddComponentToEntity(id, CRC); ComponentManager.Instance.AddComponentToEntity(id, CC); ComponentManager.Instance.AddComponentToEntity(id, wc); return(id); }
// Creating wall on the nearest point to this position public void CreateWall(Vector3 position) { WallComponent pointWc = GetNearestPoint(position); if (pointWc.FieldCoordinates.y < indexOfFirstRow || pointWc.IsWall) { return; } GameObject instance = Instantiate(_wallPrefab); pointWc.SetValue(true); instance.transform.position = pointWc.Position; instance.transform.localScale = GlobalVariables.CELL_SIZE * 0.5f; FieldMatrix.SetValueTo(pointWc.FieldCoordinates.x, pointWc.FieldCoordinates.y, pointWc); }
public Blueprint(int width, int height) { this.Width = width; this.Height = height; var numTiles = width * height; this.WallComp = new WallComponent(); WallComp.blueprint = this; this.WallsAt = new List <int>(); this.Walls = new WallTile[numTiles]; this.Ground = new BlueprintGround[numTiles]; this.Floor = new FloorComponent[numTiles]; this.Objects = new BlueprintObjectList[numTiles]; this.Rooms = new RoomMap(); this.RoomData = new BlueprintRoom[0]; }
// Overloading method of getting nearest point public WallComponent GetNextPointInDirection(WallComponent wc, ref Vector2 direction) { return(GetNextPointInDirection(wc.FieldCoordinates.x, wc.FieldCoordinates.y, ref direction)); }
public override object Remove(Type compCls) { if (compCls == typeof(AreaTriggerComponent)) { this.AreaTriggerComp = null; } else if (compCls == typeof(ArmoryComponent)) { this.ArmoryComp = null; } else if (compCls == typeof(AssetComponent)) { this.AssetComp = null; } else if (compCls == typeof(AttackerComponent)) { this.AttackerComp = null; } else if (compCls == typeof(BarracksComponent)) { this.BarracksComp = null; } else if (compCls == typeof(BoardItemComponent)) { this.BoardItemComp = null; } else if (compCls == typeof(BuildingAnimationComponent)) { this.BuildingAnimationComp = null; } else if (compCls == typeof(BuildingComponent)) { this.BuildingComp = null; } else if (compCls == typeof(CantinaComponent)) { this.CantinaComp = null; } else if (compCls == typeof(ChampionComponent)) { this.ChampionComp = null; } else if (compCls == typeof(CivilianComponent)) { this.CivilianComp = null; } else if (compCls == typeof(ClearableComponent)) { this.ClearableComp = null; } else if (compCls == typeof(DamageableComponent)) { this.DamageableComp = null; } else if (compCls == typeof(DefenderComponent)) { this.DefenderComp = null; } else if (compCls == typeof(DefenseLabComponent)) { this.DefenseLabComp = null; } else if (compCls == typeof(DroidComponent)) { this.DroidComp = null; } else if (compCls == typeof(DroidHutComponent)) { this.DroidHutComp = null; } else if (compCls == typeof(SquadBuildingComponent)) { this.SquadBuildingComp = null; } else if (compCls == typeof(NavigationCenterComponent)) { this.NavigationCenterComp = null; } else if (compCls == typeof(FactoryComponent)) { this.FactoryComp = null; } else if (compCls == typeof(FleetCommandComponent)) { this.FleetCommandComp = null; } else if (compCls == typeof(FollowerComponent)) { this.FollowerComp = null; } else if (compCls == typeof(GameObjectViewComponent)) { this.GameObjectViewComp = null; } else if (compCls == typeof(GeneratorComponent)) { this.GeneratorComp = null; } else if (compCls == typeof(GeneratorViewComponent)) { this.GeneratorViewComp = null; } else if (compCls == typeof(HealerComponent)) { this.HealerComp = null; } else if (compCls == typeof(HealthComponent)) { this.HealthComp = null; } else if (compCls == typeof(TroopShieldComponent)) { this.TroopShieldComp = null; } else if (compCls == typeof(TroopShieldViewComponent)) { this.TroopShieldViewComp = null; } else if (compCls == typeof(TroopShieldHealthComponent)) { this.TroopShieldHealthComp = null; } else if (compCls == typeof(HealthViewComponent)) { this.HealthViewComp = null; } else if (compCls == typeof(HQComponent)) { this.HQComp = null; } else if (compCls == typeof(KillerComponent)) { this.KillerComp = null; } else if (compCls == typeof(LootComponent)) { this.LootComp = null; } else if (compCls == typeof(MeterShaderComponent)) { this.MeterShaderComp = null; } else if (compCls == typeof(OffenseLabComponent)) { this.OffenseLabComp = null; } else if (compCls == typeof(PathingComponent)) { this.PathingComp = null; } else if (compCls == typeof(SecondaryTargetsComponent)) { this.SecondaryTargetsComp = null; } else if (compCls == typeof(ShieldBorderComponent)) { this.ShieldBorderComp = null; } else if (compCls == typeof(ShieldGeneratorComponent)) { this.ShieldGeneratorComp = null; } else if (compCls == typeof(SizeComponent)) { this.SizeComp = null; } else if (compCls == typeof(ShooterComponent)) { this.ShooterComp = null; } else if (compCls == typeof(StarportComponent)) { this.StarportComp = null; } else if (compCls == typeof(StateComponent)) { this.StateComp = null; } else if (compCls == typeof(StorageComponent)) { this.StorageComp = null; } else if (compCls == typeof(SupportComponent)) { this.SupportComp = null; } else if (compCls == typeof(SupportViewComponent)) { this.SupportViewComp = null; } else if (compCls == typeof(TacticalCommandComponent)) { this.TacticalCommandComp = null; } else if (compCls == typeof(ChampionPlatformComponent)) { this.ChampionPlatformComp = null; } else if (compCls == typeof(TeamComponent)) { this.TeamComp = null; } else if (compCls == typeof(TrackingComponent)) { this.TrackingComp = null; } else if (compCls == typeof(TrackingGameObjectViewComponent)) { this.TrackingGameObjectViewComp = null; } else if (compCls == typeof(TransformComponent)) { this.TransformComp = null; } else if (compCls == typeof(TransportComponent)) { this.TransportComp = null; } else if (compCls == typeof(TroopComponent)) { this.TroopComp = null; } else if (compCls == typeof(TurretBuildingComponent)) { this.TurretBuildingComp = null; } else if (compCls == typeof(TurretShooterComponent)) { this.TurretShooterComp = null; } else if (compCls == typeof(WalkerComponent)) { this.WalkerComp = null; } else if (compCls == typeof(WallComponent)) { this.WallComp = null; } else if (compCls == typeof(BuffComponent)) { this.BuffComp = null; } else if (compCls == typeof(TrapComponent)) { this.TrapComp = null; } else if (compCls == typeof(TrapViewComponent)) { this.TrapViewComp = null; } else if (compCls == typeof(HousingComponent)) { this.HousingComp = null; } else if (compCls == typeof(SpawnComponent)) { this.SpawnComp = null; } return(base.Remove(compCls)); }
protected override Entity AddComponentAndDispatchAddEvent(ComponentBase comp, Type compCls) { bool flag = false; if (comp is AreaTriggerComponent) { this.AreaTriggerComp = (AreaTriggerComponent)comp; flag = true; } if (comp is ArmoryComponent) { this.ArmoryComp = (ArmoryComponent)comp; flag = true; } if (comp is AssetComponent) { this.AssetComp = (AssetComponent)comp; flag = true; } if (comp is AttackerComponent) { this.AttackerComp = (AttackerComponent)comp; flag = true; } if (comp is BarracksComponent) { this.BarracksComp = (BarracksComponent)comp; flag = true; } if (comp is BoardItemComponent) { this.BoardItemComp = (BoardItemComponent)comp; flag = true; } if (comp is BuildingAnimationComponent) { this.BuildingAnimationComp = (BuildingAnimationComponent)comp; flag = true; } if (comp is BuildingComponent) { this.BuildingComp = (BuildingComponent)comp; flag = true; } if (comp is ChampionComponent) { this.ChampionComp = (ChampionComponent)comp; flag = true; } if (comp is CivilianComponent) { this.CivilianComp = (CivilianComponent)comp; flag = true; } if (comp is ClearableComponent) { this.ClearableComp = (ClearableComponent)comp; flag = true; } if (comp is DamageableComponent) { this.DamageableComp = (DamageableComponent)comp; flag = true; } if (comp is DefenderComponent) { this.DefenderComp = (DefenderComponent)comp; flag = true; } if (comp is DefenseLabComponent) { this.DefenseLabComp = (DefenseLabComponent)comp; flag = true; } if (comp is DroidComponent) { this.DroidComp = (DroidComponent)comp; flag = true; } if (comp is DroidHutComponent) { this.DroidHutComp = (DroidHutComponent)comp; flag = true; } if (comp is SquadBuildingComponent) { this.SquadBuildingComp = (SquadBuildingComponent)comp; flag = true; } if (comp is NavigationCenterComponent) { this.NavigationCenterComp = (NavigationCenterComponent)comp; flag = true; } if (comp is FactoryComponent) { this.FactoryComp = (FactoryComponent)comp; flag = true; } if (comp is CantinaComponent) { this.CantinaComp = (CantinaComponent)comp; flag = true; } if (comp is FleetCommandComponent) { this.FleetCommandComp = (FleetCommandComponent)comp; flag = true; } if (comp is FollowerComponent) { this.FollowerComp = (FollowerComponent)comp; flag = true; } if (comp is GameObjectViewComponent) { this.GameObjectViewComp = (GameObjectViewComponent)comp; flag = true; } if (comp is GeneratorComponent) { this.GeneratorComp = (GeneratorComponent)comp; flag = true; } if (comp is GeneratorViewComponent) { this.GeneratorViewComp = (GeneratorViewComponent)comp; flag = true; } if (comp is HealerComponent) { this.HealerComp = (HealerComponent)comp; flag = true; } if (comp is TroopShieldComponent) { this.TroopShieldComp = (TroopShieldComponent)comp; flag = true; } if (comp is TroopShieldViewComponent) { this.TroopShieldViewComp = (TroopShieldViewComponent)comp; flag = true; } if (comp is TroopShieldHealthComponent) { this.TroopShieldHealthComp = (TroopShieldHealthComponent)comp; flag = true; } if (comp is HealthComponent) { this.HealthComp = (HealthComponent)comp; flag = true; } if (comp is HealthViewComponent) { this.HealthViewComp = (HealthViewComponent)comp; flag = true; } if (comp is HQComponent) { this.HQComp = (HQComponent)comp; flag = true; } if (comp is KillerComponent) { this.KillerComp = (KillerComponent)comp; flag = true; } if (comp is LootComponent) { this.LootComp = (LootComponent)comp; flag = true; } if (comp is MeterShaderComponent) { this.MeterShaderComp = (MeterShaderComponent)comp; flag = true; } if (comp is OffenseLabComponent) { this.OffenseLabComp = (OffenseLabComponent)comp; flag = true; } if (comp is PathingComponent) { this.PathingComp = (PathingComponent)comp; flag = true; } if (comp is SecondaryTargetsComponent) { this.SecondaryTargetsComp = (SecondaryTargetsComponent)comp; flag = true; } if (comp is ShieldBorderComponent) { this.ShieldBorderComp = (ShieldBorderComponent)comp; flag = true; } if (comp is ShieldGeneratorComponent) { this.ShieldGeneratorComp = (ShieldGeneratorComponent)comp; flag = true; } if (comp is SizeComponent) { this.SizeComp = (SizeComponent)comp; flag = true; } if (comp is ShooterComponent) { this.ShooterComp = (ShooterComponent)comp; flag = true; } if (comp is StarportComponent) { this.StarportComp = (StarportComponent)comp; flag = true; } if (comp is StateComponent) { this.StateComp = (StateComponent)comp; flag = true; } if (comp is StorageComponent) { this.StorageComp = (StorageComponent)comp; flag = true; } if (comp is SupportComponent) { this.SupportComp = (SupportComponent)comp; flag = true; } if (comp is SupportViewComponent) { this.SupportViewComp = (SupportViewComponent)comp; flag = true; } if (comp is TacticalCommandComponent) { this.TacticalCommandComp = (TacticalCommandComponent)comp; flag = true; } if (comp is ChampionPlatformComponent) { this.ChampionPlatformComp = (ChampionPlatformComponent)comp; flag = true; } if (comp is TeamComponent) { this.TeamComp = (TeamComponent)comp; flag = true; } if (comp is TrackingComponent) { this.TrackingComp = (TrackingComponent)comp; flag = true; } if (comp is TrackingGameObjectViewComponent) { this.TrackingGameObjectViewComp = (TrackingGameObjectViewComponent)comp; flag = true; } if (comp is TransformComponent) { this.TransformComp = (TransformComponent)comp; flag = true; } if (comp is TransportComponent) { this.TransportComp = (TransportComponent)comp; flag = true; } if (comp is TroopComponent) { this.TroopComp = (TroopComponent)comp; flag = true; } if (comp is TurretBuildingComponent) { this.TurretBuildingComp = (TurretBuildingComponent)comp; flag = true; } if (comp is TurretShooterComponent) { this.TurretShooterComp = (TurretShooterComponent)comp; flag = true; } if (comp is WalkerComponent) { this.WalkerComp = (WalkerComponent)comp; flag = true; } if (comp is WallComponent) { this.WallComp = (WallComponent)comp; flag = true; } if (comp is BuffComponent) { this.BuffComp = (BuffComponent)comp; flag = true; } if (comp is TrapComponent) { this.TrapComp = (TrapComponent)comp; flag = true; } if (comp is TrapViewComponent) { this.TrapViewComp = (TrapViewComponent)comp; flag = true; } if (comp is HousingComponent) { this.HousingComp = (HousingComponent)comp; flag = true; } if (comp is ScoutTowerComponent) { this.ScoutTowerComp = (ScoutTowerComponent)comp; flag = true; } if (comp is SpawnComponent) { this.SpawnComp = (SpawnComponent)comp; flag = true; } if (!flag && compCls != null) { Service.Logger.Error("Invalid component add: " + compCls.Name); } return(base.AddComponentAndDispatchAddEvent(comp, compCls)); }
// Constructing game field private void BuildField() { float ratio; float tempCellSize; float randomNumber; float shiftX, shiftY; Vector3 position; Probability = Probability + GlobalVariables.DIFFICULTY * 0.01f; if (Screen.width > Screen.height) { _cellCount.y = cellCount; ratio = ((float)Screen.width) / (float)Screen.height; _cellCount.x = (int)(cellCount * ratio); tempCellSize = (_camera.ViewportToWorldPoint (new Vector3(0, 1)) - _camera.ViewportToWorldPoint(new Vector3(0, 0))).y / _cellCount.y; } else { _cellCount.x = cellCount; ratio = ((float)Screen.height) / (float)Screen.width; _cellCount.y = (int)(cellCount * ratio); tempCellSize = (_camera.ViewportToWorldPoint (new Vector3(1, 0)) - _camera.ViewportToWorldPoint(new Vector3(0, 0))).x / _cellCount.x; } indexOfFirstRow = _cellCount.y / 10; FieldMatrix = new Matrix <WallComponent>(_cellCount.x, _cellCount.y + extraCellsCount); GlobalVariables.CELL_SIZE = new Vector3(tempCellSize, tempCellSize, tempCellSize); shiftX = 1f / _cellCount.x; shiftY = 1f / _cellCount.y; for (int i = 0; i < _cellCount.x; i++) { for (int j = 0; j < _cellCount.y - 1; j++) { if (j >= indexOfFirstRow) { randomNumber = Random.value; } else { randomNumber = 1; } position = _camera.ViewportToWorldPoint(new Vector3(i * shiftX + shiftX / 2, j * shiftY + shiftY / 2, 5)); GameObject go = Instantiate( (randomNumber <= Probability) ? _wallPrefab : _emptyWallPrefab, position, Quaternion.identity, _wallsParent); go.transform.localScale = GlobalVariables.CELL_SIZE * 0.5f; WallComponent wc = go.GetComponent <WallComponent>(); wc.SetFieldValues(i, j, randomNumber <= Probability); FieldMatrix.SetValueTo(i, j, wc); } // Creating extra cells without walls for (int j = _cellCount.y - 1; j < _cellCount.y + extraCellsCount; j++) { position = _camera.ViewportToWorldPoint(new Vector3(i * shiftX + shiftX / 2, j * shiftY + shiftY / 2, 5)); GameObject go = Instantiate( _emptyWallPrefab, position, Quaternion.identity, _wallsParent); go.transform.localScale = GlobalVariables.CELL_SIZE * 0.5f; WallComponent wc = go.GetComponent <WallComponent>(); wc.SetFieldValues(i, j, false); FieldMatrix.SetValueTo(i, j, wc); } } }
public void OpenEditorWindow(WallComponent wallComponent) { }
/// <summary> /// Handles Player versus Wall collision /// </summary> /// <param name="Player"> Id of the player entity </param> /// <param name="WallEnt"> Id of the wall entity </param> private void PlayerVsWallColl(int Player, int WallEnt, GameTime gameTime) { PlayerComponent playerComp = ComponentManager.Instance.GetEntityComponent <PlayerComponent>(Player); VelocityComponent pvc = ComponentManager.Instance.GetEntityComponent <VelocityComponent>(Player); DirectionComponent pdc = ComponentManager.Instance.GetEntityComponent <DirectionComponent>(Player); CollisionRectangleComponent crc1 = ComponentManager.Instance.GetEntityComponent <CollisionRectangleComponent>(WallEnt); CollisionRectangleComponent crc2 = ComponentManager.Instance.GetEntityComponent <CollisionRectangleComponent>(Player); PositionComponent pc = ComponentManager.Instance.GetEntityComponent <PositionComponent>(Player); PositionComponent pcwall = ComponentManager.Instance.GetEntityComponent <PositionComponent>(WallEnt); WallComponent wall = ComponentManager.Instance.GetEntityComponent <WallComponent>(WallEnt); if (wall.wall == Wall.LeftWall) { if (crc2.CollisionRec.X + crc2.CollisionRec.Width * 0.5 < crc1.CollisionRec.X) { pc.position.X = Game.Instance.GraphicsDevice.Viewport.Width - 1 - crc2.CollisionRec.Width * 0.5f; } } else if (wall.wall == Wall.RightWall) { if (crc2.CollisionRec.X + crc2.CollisionRec.Width * 0.5 > crc1.CollisionRec.X) { pc.position.X = 1 - crc2.CollisionRec.Width * 0.5f; } } else if (wall.wall == Wall.TopWall && !playerComp.isFalling) { if (pdc.directio != Direction.Still) { changeDir(pdc); pdc.preDir = pdc.directio; pdc.directio = Direction.Still; } pvc.velocity.Y = 0; pvc.velocity.Y += 500 * (float)gameTime.ElapsedGameTime.TotalSeconds; playerComp.isFalling = true; HealthComponent hc = ComponentManager.Instance.GetEntityComponent <HealthComponent>(Player); //hc.health -= 1; } else if (wall.wall == Wall.BottomWall) { //@TODO // only loose life when the player jump on the floor, not when the player falls to the ground // and have some kind of timer unti you can jump away OnFloorComponent fc = ComponentManager.Instance.GetEntityComponent <OnFloorComponent>(Player); playerComp.isFalling = false; if (pdc.directio != Direction.Still) { pvc.velocity.Y = 0; changeDir(pdc); pdc.preDir = pdc.directio; pdc.directio = Direction.Still; } //else if(pdc.directio == Direction.Still) //{ // pvc.velocity.Y = 0; //} pvc.velocity.Y = 0; pvc.velocity.Y -= 500F * (float)gameTime.ElapsedGameTime.TotalSeconds; HealthComponent hc = ComponentManager.Instance.GetEntityComponent <HealthComponent>(Player); if (fc == null) { fc = new OnFloorComponent(); ComponentManager.Instance.AddComponentToEntity(Player, fc); hc.health -= 1; ComponentManager.Instance.AddComponentToEntity(Player, new SoundEffectComponent("splat")); } } }