public UnitEntity(AbstractPlayerData player, Unit unit, string name) { Point = unit.Point; _unit = unit; _player = player; _model = MainApplication.ManagerInstance.Content.Load<Model>("Content\\Models\\" + name); _animations.Add("Idle", new ModelAnimation("Content\\Animations\\" + name + "\\Idle")); Status = ModelStatus.Standing; for (int i = 0; i < unit.Formation.Positions; ++i) { Vector3 startOffset = unit.Formation.GetPosition(i); _items.Add(new UnitItem(Position + startOffset, startOffset, Rotation)); } _scaleMatrix = Matrix.CreateScale(Scale * 0.3f); int boneCount = _model.Bones.Count; this.boneTransforms = new Matrix[boneCount]; _model.CopyBoneTransformsTo(this.boneTransforms); this.boneTransformsOriginal = new Matrix[boneCount]; _model.CopyBoneTransformsTo(this.boneTransformsOriginal); this.absoluteBoneTransforms = new Matrix[boneCount]; SetAnimation("Idle"); }
public Unit(HexPoint point, AbstractPlayerData player, UnitData data) { _point = point; _player = player; _data = data; Strength = 10; _unitAI = _data.DefaultUnitAI; UpdateSpotting(); InitTransitions(); InitFormation(); _entity = new UnitEntity(player, this, _data.ModelName); _entity.Point = point; _entity.Scale = new Vector3(_data.ModelScale); _unitActionBillboard = new BillboardSystem<UnitAction>(MainApplication.Instance.GraphicsDevice, MainApplication.Instance.Content); _unitActionBillboard.AddEntity(UnitAction.Idle, Provider.GetAtlas("UnitActionAtlas").GetTexture("Idle"), new Vector2(2, 2)); _unitActionBillboard.AddEntity(UnitAction.Move, Provider.GetAtlas("UnitActionAtlas").GetTexture("Move"), new Vector2(2, 2)); _unitActionBillboard.AddEntity(UnitAction.BuildFarm, Provider.GetAtlas("UnitActionAtlas").GetTexture("BuildFarm"), new Vector2(2, 2)); _unitActionBillboard.AddEntity(UnitAction.BuildRoad, Provider.GetAtlas("UnitActionAtlas").GetTexture("BuildRoad"), new Vector2(2, 2)); _unitActionBillboard.AddEntity(UnitAction.Found, Provider.GetAtlas("UnitActionAtlas").GetTexture("Found"), new Vector2(2, 2)); UpdateUnitAction(); // path mesh _pathMesh = new Mesh(MainApplication.Instance.GraphicsDevice, "paths"); if( TextureManager.Instance.Device == null ) TextureManager.Instance.Device = MainApplication.Instance.GraphicsDevice; TextureManager.Instance.Add("paths", MainApplication.Instance.Content.Load<Texture2D>("Content/Textures/Ground/paths")); _pathMesh.LoadContent(MainApplication.Instance.Content); }
public void SetSpotted(AbstractPlayerData player, bool spotted = true) { SetSpotted(player.Id, spotted); }
public bool IsSpotted(AbstractPlayerData player) { return IsSpotted(player.Id); }
public MarineModelEntity(AbstractPlayerData player, Unit unit) : base(player, unit, "PlayerMarine_mdla") { Scale = new Vector3(0.2f); }
public PlayerChangedEventArgs(AbstractPlayerData oldPlayer, AbstractPlayerData newPlayer) { _oldPlayer = oldPlayer; _newPlayer = newPlayer; }