public RadarSpaceManager(ContentManager Content, SpriteBatch spriteBatch, GraphicsDevice graphics, BorderManager borderManager, PlayerShipManager playerShipManager, ProjectileManager projectileManager, SpaceObjectManager spaceObjectManager, ClientShipManager clientShipManager, WarpHoleManager warpholeManager, GameWindow gameWindow) { textFont = Content.Load <SpriteFont>(@"GUI/drawFont"); tex_Radar = Content.Load <Texture2D>(@"GUI/radar"); tex_DotW = Content.Load <Texture2D>(@"GUI/dot_w"); tex_OrbitalRing = Content.Load <Texture2D>(@"GUI/planetrings"); tex_Ship = Content.Load <Texture2D>(@"GUI/Minimap/Hud_ShipRadar"); tex_NetworkShip = Content.Load <Texture2D>(@"GUI/Minimap/otherShips"); tex_EdgeOfRadar = Content.Load <Texture2D>(@"GUI/Minimap/edgeofradar"); tex_Sun = Content.Load <Texture2D>(@"GUI/Minimap/sunMinimap"); tex_Warp = Content.Load <Texture2D>(@"GUI/Minimap/warp3"); _graphics = graphics; _content = Content; _borderManager = borderManager; _playerShipManager = playerShipManager; _projectileManager = projectileManager; _clientShipManager = clientShipManager; _radarCamera = new Camera2D(gameWindow); _spaceObjectManager = spaceObjectManager; _spriteBatch = spriteBatch; _warpholeManager = warpholeManager; radarWidth = 300; radarHeight = 300; radarTarget = new RenderTarget2D(spriteBatch.GraphicsDevice, radarWidth, radarHeight, false, SurfaceFormat.Color, DepthFormat.Depth24); // Adds all of the dynamically sized rings for Minimap. planetRings = new List <Texture2D>(); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_50px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_68px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_80px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_100px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_120px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_150px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_200px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_250px")); planetRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseRing_300px")); moonRings = new List <Texture2D>(); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_30px")); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_40px")); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_50px")); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_80px")); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_100px")); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_120px")); moonRings.Add(Content.Load <Texture2D>(@"GUI/Minimap/BaseMoonRing_150px")); _radarCamera._zoom = 1.2f; }
public static SpaceStateManager BuildSpaceStateManager(int?areaID, IMessenger messenger, INetworkingService _networkingService) { //Null references, unused by the Simulator TextureManager textureManager = null; SpriteBatch spriteBatch = null; ParticleManager particleManager = null; Texture2D warpholeTexture = null; Texture2D borderTexture = null; SelectionManager selectionManager = null; IGlobalGameUISingleton globalGameUISingleton = null; MessageService_ToServer messageService = new MessageService_ToServer(messenger); SimulationManager simulationManager = new SimulationManager(); CollisionManager collisionManager = new CollisionManager(messageService); PlayerShipManager playerShipManager = new PlayerShipManager(messageService); IClientPlayerInfoManager clientPlayerInfoManager = new PlayablePlayerInfoManager(playerShipManager); TargetingService targetingService = new TargetingService(); TeamManager teamManager = new TeamManager(targetingService); PhysicsManager physicsManager = new PhysicsManager(); BorderManager borderManager = new BorderManager(borderTexture, spriteBatch, physicsManager); ProjectileManager projectileManager = new ProjectileManager(particleManager, physicsManager.World, spriteBatch, targetingService, simulationManager, messageService, collisionManager); ClientShipManager clientShipManager = new ClientShipManager(particleManager, playerShipManager, spriteBatch, textureManager, simulationManager, targetingService, teamManager, projectileManager, messageService, clientPlayerInfoManager, true); clientShipManager.SendPositionUpdates = true; StructureFactoryManager structureFactoryManager = new StructureFactoryManager(messageService, physicsManager.World, projectileManager, targetingService, teamManager, null, clientShipManager, null, true); WarpHoleManager warpholeManager = new WarpHoleManager(messageService, particleManager, physicsManager, clientShipManager, warpholeTexture); GravityManager gravityManager = new GravityManager(physicsManager); SpaceObjectManager spaceObjectManager = new SpaceObjectManager(textureManager, messageService, spriteBatch, particleManager, physicsManager); SpaceManager spaceManager = new SpaceManager(spriteBatch, borderManager, gravityManager, physicsManager, spaceObjectManager, warpholeManager); FloatyAreaObjectManager floatyAreaObjectManager = new FloatyAreaObjectManager(physicsManager.World, textureManager, messageService, spriteBatch, particleManager); var mhi = areaID == null ? new MessageHandlerID() : new MessageHandlerID((int)areaID); SpaceStateManager spaceStateManager = new SpaceStateManager(mhi, clientPlayerInfoManager, globalGameUISingleton, collisionManager, _networkingService, physicsManager, playerShipManager, projectileManager, selectionManager, simulationManager, clientShipManager, spaceManager, structureFactoryManager, targetingService, teamManager, warpholeManager, messageService, floatyAreaObjectManager); spaceStateManager.SetAreaId(areaID); return(spaceStateManager); }
public static BorderManager GetInstance() { if (_instance == null) { _instance = new BorderManager(); } return(_instance); }
private static void ChromeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(d)) { return; } Window window = d as Window; if (window != null) { // don't care about old chrome since it has no state Chrome newChrome = e.NewValue as Chrome; if (__legacyBorder) { if (newChrome == null) { LegacyBorderManager.SetManager(window, null); } else if (e.NewValue != e.OldValue) { var worker = LegacyBorderManager.GetManager(window); if (worker == null) { worker = new LegacyBorderManager(); LegacyBorderManager.SetManager(window, worker); } else { worker.UpdateChrome(newChrome); } } } else { if (newChrome == null) { BorderManager.SetManager(window, null); } else if (e.NewValue != e.OldValue) { var worker = BorderManager.GetManager(window); if (worker == null) { worker = new BorderManager(); BorderManager.SetManager(window, worker); } else { worker.UpdateChrome(newChrome); } } } } }
public BorderWindow(BorderManager manager) { // only works if set directly, no in override this.Background = Brushes.Transparent; _manager = manager; CreateBinding(IsActiveProperty.Name, _manager.ContentWindow, IsContentActiveProperty); UpdateChromeBindings(Chrome.GetChrome(_manager.ContentWindow)); }
public HandleControl(Handle handle, SubCircleControl parent, Canvas pnl, Rect bounds, BorderManager borderManager) { this.handle = handle; this.bounds = bounds; this.borderManager = borderManager; this.parent = parent; InitializeMainControls(pnl); }
protected new void Awake() { base.Awake(); spiders = GameObject.FindGameObjectsWithTag("SpiderCluster"); Vector3 tableCentreObjectPosition = GameObject.FindGameObjectWithTag("TableCentre").transform.position; tableCentrePosition = new Vector3(tableCentreObjectPosition.x, tableCentreObjectPosition.y, tableCentreObjectPosition.z); borderManager = GameObject.Find("TableBorders").GetComponent <BorderManager>(); }
public MainClockControl(Clock clock, Canvas pnl, Rect bounds, BorderManager borderManager) { //this.pnl = pnl; this.bounds = bounds; this.borderManager = borderManager; this.clock = clock; InitializeMainControls(pnl); InitializeSubCircles(pnl); }
public SubCircleControl(SubCircle circle, MainClockControl parent, Canvas pnl, Rect bounds, BorderManager borderManager) { //this.pnl = pnl; this.bounds = bounds; this.borderManager = borderManager; this.circle = circle; this.parent = parent; InitializeMainControls(pnl); InitializeHandles(pnl); }
public BorderWindow(BorderManager manager) { // only works if set directly, no in override this.Background = Brushes.Transparent; _manager = manager; Owner = _manager.ContentWindow; //DropShadowEffect BindingTo(IsActiveProperty.Name, _manager.ContentWindow, IsContentActiveProperty); //BindingTo(Chrome.ResizeBorderThicknessProperty.Name, _manager.ContentWindow, BorderThicknessProperty); //BindingTo(Chrome.ActiveBorderBrushProperty.Name, _manager.ContentWindow, ActiveBorderBrushProperty); //BindingTo(Chrome.InactiveBorderBrushProperty.Name, _manager.ContentWindow, InactiveBorderBrushProperty); }
// Area for declaring variables pertaining to the list of planets. /// <summary> /// Creates system with Planets and Borders /// </summary> public SpaceManager(SpriteBatch spriteBatch, BorderManager borderManager, GravityManager gravityManager, PhysicsManager physicsManager, SpaceObjectManager spaceObjectManager, WarpHoleManager warpholeManager) { r = new Random(45546); _physicsManager = physicsManager; _warpholeManager = warpholeManager; _spaceObjectManager = spaceObjectManager; _borderManager = borderManager; _gravityManager = gravityManager; }
public ClockControl(Clock clock, Canvas pnl) { borderManager1 = new BorderManager(0) { BorderBrush = new SolidColorBrush(Color.FromArgb(200, Colors.WhiteSmoke.R, Colors.WhiteSmoke.G, Colors.WhiteSmoke.B)) }; borderManager2 = new BorderManager(0) { BorderBrush = new SolidColorBrush(Color.FromArgb(50, Colors.WhiteSmoke.R, Colors.WhiteSmoke.G, Colors.WhiteSmoke.B)) }; mainClock1 = new MainClockControl(clock, pnl, bounds, borderManager1); mainClock2 = new MainClockControl(clock, pnl, bounds, borderManager2); }
// Use this for initialization void Awake() { //Debug.Log("Awake"); if (instance == null) { instance = this; } else if (instance != null && this != instance) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); Initialize(); boardScript = GetComponent <BorderManager>(); //InitGame(); }
public BorderWindow(BorderManager manager) { // only works if set directly, no in override this.Background = Brushes.Transparent; _manager = manager; CreateBinding(IsActiveProperty.Name, _manager.ContentWindow, IsContentActiveProperty); //var dpiBinding = new Binding() //{ // Source = _manager.ContentWindow, // Path = new PropertyPath(UIHooks.AutoDpiScaleProperty) //}; //this.SetBinding(UIHooks.AutoDpiScaleProperty, dpiBinding); //CreateBinding(UIHooks.AutoDpiScaleProperty.Name, _manager.ContentWindow, UIHooks.AutoDpiScaleProperty); UpdateChromeBindings(Chrome.GetChrome(_manager.ContentWindow)); }
// Use this for initialization protected override void Start() { animator = GetComponent <Animator>(); //System.Random a = new System.Random(); string s = "Player0"; if (GameObject.FindGameObjectWithTag(s) == null) { target = null; } //Debug.Log(s); target = GameObject.FindGameObjectWithTag(s).transform; base.Start(); GameManager.instance.AddEnemyToList(this); BorderManager boardScript = GameManager.instance.GetComponent <BorderManager>(); light = boardScript.lights; renderer = GetComponent <Renderer>(); renderer.enabled = false; }
protected override bool IsAValidSecond(StatoController s2) { BorderManager border = BorderManager.GetInstance(); return(border.areNeighbours(_stateTemp, s2) && !_stateTemp.Player.Equals(s2.Player)); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); BorderManager = new BorderManager(_graphics.GraphicsDevice); _gameModel = new GameModel() { ContentManger = Content, GraphicsDeviceManager = _graphics, SpriteBatch = _spriteBatch, }; UpdateWindowValues(); var abilityIcon = "Battle/AbilityIcon"; _players = new List <ActorModel>() { new ActorModel() { Name = "Nude man", Attack = 1, Defence = 1, Health = 10, Speed = 5, Abilities = new AbilitiesModel() { Ability1 = new AbilityModel("Slap", abilityIcon, AbilityModel.TargetTypes.Single), Ability2 = new AbilityModel("Punch", abilityIcon, AbilityModel.TargetTypes.Single), Ability3 = new AbilityModel("A", abilityIcon, AbilityModel.TargetTypes.All), Ability4 = new AbilityModel("xyz", abilityIcon, AbilityModel.TargetTypes.Single), }, BattleStats = new BattleStatsModel(), EquipmentModel = new EquipmentModel() { EquipmentType = EquipmentModel.EquipmentTypes.Fists, LeftHandEquipmentPath = null, RightHandEquipmentPath = null, }, Lower = "Clothing/Lower/Clover", }, new ActorModel() { Name = "Glenda", Attack = 300, Defence = 2, Health = 10, Speed = 2, Abilities = new AbilitiesModel() { Ability1 = new AbilityModel("Slash", abilityIcon, AbilityModel.TargetTypes.Single), Ability2 = new AbilityModel("Stab", abilityIcon, AbilityModel.TargetTypes.Single), Ability3 = new AbilityModel("Ability 3", abilityIcon, AbilityModel.TargetTypes.Single), Ability4 = new AbilityModel("Ability 4", abilityIcon, AbilityModel.TargetTypes.All), }, BattleStats = new BattleStatsModel(), EquipmentModel = new EquipmentModel() { EquipmentType = EquipmentModel.EquipmentTypes.Both_Spear, LeftHandEquipmentPath = "Equipment/Spear", RightHandEquipmentPath = null, }, Lower = "Clothing/Lower/RangerPants", Upper = "Clothing/Upper/RangerTop", }, }; // This will be assigned in-game rather than in code like this _players[0].SkillsModel = new SwordSkillsModel(_players[0]); //_currentState = new OpeningState(_gameModel, _players); //_currentState = new BattleState(_gameModel, _players, // //null, // new List<string>() // { // "Glenda: Any reason why you're completely nude, and surrounded by vampire snakes?", // "Nude man: A really fun night I guess..?", // "Glenda: Uugh. Just kill them!", // } //); _currentState = new RoamingState(_gameModel, _players); _currentState.LoadContent(); _transition = new FourCornersTransition(_gameModel); }
public void MoveEnemy() { int x = 0; int y = 0; if (target == null) { return; } y = (int)(target.position.y - gameObject.transform.position.y); x = (int)(target.position.x - gameObject.transform.position.x); //System.Random a = new System.Random(); x = (Math.Abs(x) < 1e-5) ? 0 : Math.Sign(x); y = (Math.Abs(y) < 1e-5) ? 0 : Math.Sign(y); // try to design strategy to aviod any obstacles RaycastHit2D hit = new RaycastHit2D(); //System.Random a = new System.Random(); bool CanMoveWithoutDijkstra = false; //if (y == 0) //{ // if(CanMove(x, 0, out hit)) // AttempMove<Player>(x, 0); // else // CanMoveWithoutDijkstra = false; //} //else //{ // if (CanMove(0, y, out hit)) // AttempMove<Player>(0, y); // else // CanMoveWithoutDijkstra = false; //} if (!CanMoveWithoutDijkstra) { BorderManager boardScript = GameManager.instance.GetComponent <BorderManager>(); //FileStream fs = new FileStream("Running.log", FileMode.Create); //string s = " Enemy is at " + gameObject.transform.position.x + gameObject.transform.position.y + "\n"; //Debug.Log(s); //byte[] buffer = Encoding.ASCII.GetBytes(s); //fs.Write(buffer, 0, buffer.Length); //s = " Player is at " + target.transform.position.x + target.transform.position.y + "\n"; //Debug.Log(s); //buffer = Encoding.ASCII.GetBytes(s); //fs.Write(buffer, 0, buffer.Length); //fs.Close(); List <GraphNode> steps = boardScript.Dijkstra(new Vector2_int(transform.position.x, transform.position.y), new Vector2_int(target.position.x, target.position.y)); if (steps != null && steps.Count > 1) { x = steps[1].pos.x - (int)gameObject.transform.position.x; y = steps[1].pos.y - (int)gameObject.transform.position.y; AttempMove <Player>(x, y); } if (steps == null) { Debug.Log("steps is null"); } //for(int i = 0; i < steps.Count; i++) //{ // Debug.Log(steps[i].pos.x + " " + steps[i].pos.y); //} } //Vector2 current_pos = (Vector2)transform.position; for (int i = 0; i < light.Count; i++) { if (GameManager.Distance(gameObject, light[i]) < distance && light[i].GetComponent <Light>().IsOn) { renderer.enabled = true; animator.enabled = true; return; } } renderer.enabled = false; animator.enabled = false; return; }
DrawableSpaceStateManager _buildSpaceStateManager(GlobalGameUISingleton globalGameUiSingleton, CameraService cameraService, TextureManager textureManager, ParticleManager particleManager, TextDrawingService textDrawingService, MessageService_ToServer messageService, IClientWebViewConfig clientWebviewConfig, LidgrenNetworkingService networkingService, BloomComponent bloom) { CollisionManager instance_collisionManager; ParticleManager instance_particleManager = null; SimulationManager instance_simulationManager; TargetingService instance_targetingService; TeamManager instance_teamManager; UIConversionService instance_uiConversionService; ClientShipManager instance_clientShipManager; PhysicsManager instance_physicsManager; ProjectileManager instance_projectileManager; StructureFactoryManager instance_structureFactoryManager; WarpHoleManager instance_warpholeManager; SelectionManager instance_selectionManager; FloatyAreaObjectManager instance_floatyAreaObjectManager; //Space unique BackgroundManager instance_backgroundManager = null; SpaceManager instance_spaceManager; BorderManager instance_borderManager = null; GravityManager instance_gravityManager; SpaceObjectManager instance_spaceObjectManager; instance_collisionManager = new CollisionManager(messageService); if (_loadGraphics) { instance_particleManager = new ParticleManager(_graphics, _spriteBatch, Content, textureManager); } instance_simulationManager = new SimulationManager(); instance_targetingService = new TargetingService(); instance_teamManager = new TeamManager(instance_targetingService); PlayerShipManager instance_playerShipManager = new PlayerShipManager(messageService); IClientPlayerInfoManager instance_clientPlayerInfoManager = new PlayablePlayerInfoManager(instance_playerShipManager); instance_uiConversionService = new UIConversionService(cameraService, instance_playerShipManager, _spriteBatch); instance_physicsManager = new PhysicsManager(); instance_projectileManager = new ProjectileManager(instance_particleManager, instance_physicsManager.World, _spriteBatch, instance_targetingService, instance_simulationManager, messageService, instance_collisionManager); instance_clientShipManager = new ClientShipManager(instance_particleManager, instance_playerShipManager, _spriteBatch, textureManager, instance_simulationManager, instance_targetingService, instance_teamManager, instance_projectileManager, messageService, instance_clientPlayerInfoManager, false); instance_structureFactoryManager = new StructureFactoryManager(messageService, instance_physicsManager.World, instance_projectileManager, instance_targetingService, instance_teamManager, textureManager, instance_clientShipManager, _spriteBatch, false); instance_warpholeManager = new WarpHoleManager(messageService, instance_particleManager, instance_physicsManager, instance_clientShipManager, _loadGraphics ? textureManager.Warphole : null); instance_selectionManager = new SelectionManager(textDrawingService, _spriteBatch, instance_clientShipManager, messageService, instance_physicsManager, instance_playerShipManager, instance_targetingService, instance_uiConversionService); if (_loadGraphics) { instance_backgroundManager = new BackgroundManager(Content, instance_particleManager, _spriteBatch, cameraService, new Random(8)); } instance_borderManager = new BorderManager(_loadGraphics?textureManager.tex_DotW:null, _spriteBatch, instance_physicsManager); instance_gravityManager = new GravityManager(instance_physicsManager); instance_spaceObjectManager = new SpaceObjectManager(textureManager, messageService, _spriteBatch, instance_particleManager, instance_physicsManager); instance_spaceManager = new SpaceManager(_spriteBatch, instance_borderManager, instance_gravityManager, instance_physicsManager, instance_spaceObjectManager, instance_warpholeManager); instance_floatyAreaObjectManager = new FloatyAreaObjectManager(instance_physicsManager.World, textureManager, messageService, _spriteBatch, particleManager); return(new DrawableSpaceStateManager( messageService, instance_clientPlayerInfoManager, instance_backgroundManager, bloom, instance_collisionManager, this, Window, globalGameUiSingleton, networkingService, _spriteBatch, instance_particleManager, instance_physicsManager, instance_playerShipManager, instance_projectileManager, instance_selectionManager, instance_simulationManager, instance_clientShipManager, instance_spaceManager, instance_structureFactoryManager, textureManager, instance_targetingService, instance_teamManager, instance_warpholeManager, instance_spaceObjectManager, instance_uiConversionService, instance_floatyAreaObjectManager)); }