// Use this for initialization void Start() { NumberofShields = 0; agent = GetComponent <NavMeshAgent>(); mStunCheck = GetComponent <Stunable>(); Object pointerArrow = Instantiate(Resources.Load("Prefabs/ClickToMoveTarget", typeof(GameObject))); pointerArrow.name = "ClickToMoveIndicator"; clickToMoveIndicator = GameObject.Find("ClickToMoveIndicator"); mTimer = 0.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { //canTilt = true; } //Respawn with checkpoint put in start mInitialGasTimer = mGasTimer; mGasBarLength = mInitialGasTimer; mInitialShockTimer = mShockTimer; mShockBarLength = mInitialShockTimer; anim = GetComponent <Animator>(); anim.applyRootMotion = false; Sid = GameObject.Find("Sid_All_Anim"); mAudioManager = FindObjectOfType(typeof(AudioManager)) as AudioManager; if (mAudioManager) { mAudioManager.AddSoundEffect("Cough", mCoughSoundEffect); mAudioManager.AddSoundEffect("Shock", mShockSoundEffect); mAudioManager.AddSoundEffect("Sid Hover", mSIDHoverEffect); mAudioManager.AddSoundEffect("Sid Die", mSIDDieEffect); } levelMap = FindObjectOfType(typeof(MapConsole)) as MapConsole; }
public override void Update(TimeSpan timeElapsed) { // If there is a console that is focused, this one doesn't need to do anything. if (Global.FocusedConsoles.Console != null) { return; } // Run the latest action(s). ActionProcessor.Run(timeElapsed); // Center view on player MapConsole.CenterViewPortOnPoint(Map.ControlledGameObject.Position); // Run logic if valid move made by player _frameManager.Update(this, timeElapsed); if (RedrawMap) { MapConsole.IsDirty = true; RedrawMap = false; } //point.X = Math.Max(0, point.X); //point.Y = Math.Max(0, point.Y); //point.X = Math.Min(point.X, map.Width - DungeonScreen.Width); //point.Y = Math.Min(point.Y, map.Height - DungeonScreen.Height); //MapViewPoint = point; base.Update(timeElapsed); }
private static void Init() { var player = map.Actors.Single(a => a is Player) as Player; var mapConsole = new MapConsole(game, true, new AStarPathFinder()); var logConsole = new LogConsole(); var messageConsole = new MessageConsole(); var statusConsole = new StatusConsole(player); var menuConsole = new MenuConsole(Width, Height); var inventory = new InventoryConsole(player); var keyboardHandler = new KeyboardHandler(mapConsole, logConsole, messageConsole, player, inventory, menuConsole, game, () => StartGame(rnd)); var mainConsole = new MainConsole(mapConsole, logConsole, messageConsole, statusConsole, keyboardHandler, inventory); mainConsole.Children.Add(mapConsole); mainConsole.Children.Add(logConsole); mainConsole.Children.Add(messageConsole); mainConsole.Children.Add(statusConsole); mainConsole.Children.Add(inventory); mainConsole.Children.Add(menuConsole); SadConsole.Game.Instance.Screen = mainConsole; }
public KeyboardHandler(MapConsole mapConsole, LogConsole logConsole, MessageConsole messageConsole, Player player, InventoryConsole inventory, MenuConsole menuConsole, Game game, Action startGame) { this.mapConsole = mapConsole; this.logConsole = logConsole; this.messageConsole = messageConsole; this.player = player; this.inventory = inventory; this.menuConsole = menuConsole; this.game = game; this.startGame = startGame; state = InputState.Idle; mapConsole.IsFocused = true; actions = new List <Action>(); }
public PlayingScreen() { Game.Player = new Player(Coord.NONE); MapConsole = new MapConsole(100, 100, Game.GameWidth, Game.GameplayAreaHeight); Children.Add(MapConsole); GameUI = new GameUI(Game.GameWidth, Game.GameUIHeight); Children.Add(GameUI); MenuWindow = new MenuWindow(); Children.Add(MenuWindow); InventoryWindow = new InventoryWindow(Game.GameWidth / 2, Game.GameHeight - Game.GameUIHeight, new Point(Game.GameWidth / 2, 0)); Children.Add(InventoryWindow); }
static void Init() { var map = MapBuilder.Build(MapType.DUNGEON, 100, 100, "test", Color.SlateGray, Color.White); var console = new MapConsole(map); console.IsVisible = true; console.IsFocused = true; var player = new PlayerFactory() .SetName("Player") .Build(); map.AddEntity(player); console.Focus = player; player.Position = (25, 25); //console.FillWithRandomGarbage(); Global.CurrentScreen = console; }
public MPEngine(RLRootConsole rootConsole, string name, IPEndPoint endpoint) { this.LocalName = name; var config = new NetPeerConfiguration("PythonRouge"); config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); Client = new NetClient(config); Client.Start(); Console.WriteLine("Discovering local peers"); Client.Connect(endpoint); //Client.DiscoverLocalPeers(32078); this.RootConsole = rootConsole; MapConsole.SetBackColor(0, 0, 70, 50, RLColor.Blue); InvConsole.SetBackColor(0, 0, 20, 70, RLColor.Cyan); //var pos = Map.findPPos(); //Player.pos = pos; this.LocalName = name; }
public static bool IsBlocked(IUsable target, PlayerControl pc) { if (target == null) { return(false); } Console targetConsole = target.TryCast <Console>(); SystemConsole targetSysConsole = target.TryCast <SystemConsole>(); MapConsole targetMapConsole = target.TryCast <MapConsole>(); if ((targetConsole != null && IsBlocked(targetConsole, pc)) || (targetSysConsole != null && IsBlocked(targetSysConsole, pc)) || (targetMapConsole != null && !MapOptions.canUseAdmin)) { return(true); } return(false); }
private static void Init() { var fpsCounter = new SadConsole.Game.FPSCounterComponent(SadConsole.Game.Instance); SadConsole.Game.Instance.Components.Add(fpsCounter); fpsCounter.Enabled = ENABLE_FPS_COUNTER; fpsCounter.Visible = ENABLE_FPS_COUNTER; CurrentMap = GenerateMap(); AddPlayer(Coord.Get(5, 6)); AddTestDummy(Coord.Get(73, 23)); MapConsole = CurrentMap.CreateRenderer(MapConsoleWidth, MapConsoleHeight); MapConsole.CenterViewportOn(Player.Position); // Set our new console as the thing to render and process SadConsole.Global.CurrentScreen = MapConsole; SadConsole.Global.FocusedConsoles.Set(MapConsole); SadConsole.Settings.ResizeMode = SadConsole.Settings.WindowResizeOptions.Stretch; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Engine.Initialize(_graphics, "IBM.font", 100, 34); Engine.UseMouse = true; Engine.UseKeyboard = true; _map = new MapConsole(this, 80, 34); _map.PlayerTeleportEvent += PlayerTeleportEvent; _map.PlayerMoveEvent += PlayerMoveEvent; _map.NewGameEvent += NewGameEvent; _status = new StatusConsole(20, 34); _status.Position = new Point(80, 0); Engine.ConsoleRenderStack = new SadConsole.Consoles.ConsoleList { _map, _status }; Engine.ActiveConsole = Engine.ConsoleRenderStack[0]; NextLevel(); base.Initialize(); }
public SPEngine(RLRootConsole rootConsole) { player = new Player(new Vector2(0, 0), '@', 100, "Tom", this); this.rootConsole = rootConsole; MapGenerate(); do { rootConsole.Clear(); MapConsole.Clear(); MapConsole.Print(0, 0, "Loading Map", RLColor.White); RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10); rootConsole.Draw(); Thread.Sleep(200); MapConsole.Print(0, 0, "Loading Map.", RLColor.White); RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10); rootConsole.Draw(); Thread.Sleep(200); MapConsole.Print(0, 0, "Loading Map..", RLColor.White); RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10); rootConsole.Draw(); Thread.Sleep(200); MapConsole.Print(0, 0, "Loading Map...", RLColor.White); RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10); rootConsole.Draw(); } while(mapLoadDone == false); inv = new Inventory(InvConsole); side = new SidePanel(SideConsole, player, 21, 96, this); TickTimer.Elapsed += new ElapsedEventHandler(OnTick); TickTimer.Interval = 200; TickTimer.Enabled = true; AddMonsters(); player.pos = map.findPPos(); entityList.Add(player); ConstructGrid(); ShadowCast.ComputeVisibility(map.grid, player.pos, 7.5f, player.name); inv.items.Add(new Weapon((char)234, 300, 4)); }
public Player(MapConsole map) : base(map, Color.Green, Color.Black, 1) { }
public static bool Prefix(ref float __result, MapConsole __instance, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { canUse = couldUse = false; return(true); }
public static void Postfix(AirshipStatus __instance) { MapConsole AdminTable = Object.FindObjectOfType <MapConsole>(); if (BetterAirShip.MoveAdmin.GetValue() != 0) { GameObject MapFloating = GameObject.Find("Cockpit/cockpit_mapfloating"); if (BetterAirShip.MoveAdmin.GetValue() == 1) { // Admin AdminTable.transform.position = new Vector2(-17.269f, 1.375f); AdminTable.transform.rotation = Quaternion.Euler(new Vector3(0.000f, 0.000f, 350.316f)); AdminTable.transform.localScale = new Vector3(1f, 1f, 1f); // Maping Float MapFloating.transform.position = new Vector2(-17.736f, 2.36f); MapFloating.transform.rotation = Quaternion.Euler(new Vector3(0.000f, 0.000f, 350f)); MapFloating.transform.localScale = new Vector3(1f, 1f, 1f); } if (BetterAirShip.MoveAdmin.GetValue() == 2) { // New Admin AdminTable.transform.position = new Vector3(5.078f, 3.4f, 1f); AdminTable.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, 76.1f)); AdminTable.transform.localScale = new Vector3(1.200f, 1.700f, 1f); MapFloating.transform.localScale = new Vector3(0f, 0f, 0f); } } if (BetterAirShip.MoveElectrical.GetValue() != 0) { GameObject Electrical = GameObject.Find("GapRoom/task_lightssabotage (gap)"); if (BetterAirShip.MoveElectrical.GetValue() == 1) { // Electical Cargo Electrical.transform.position = new Vector2(-8.818f, 13.184f); Electrical.transform.localScale = new Vector3(0.909f, 0.818f, 1f); // Support GameObject OriginalSupport = GameObject.Find("Vault/cockpit_comms"); GameObject SupportElectrical = Object.Instantiate(OriginalSupport, OriginalSupport.transform); SupportElectrical.transform.position = new Vector2(-8.792f, 13.242f); SupportElectrical.transform.localScale = new Vector3(1f, 1f, 1f); } if (BetterAirShip.MoveElectrical.GetValue() == 2) { // Light Electrical.transform.position = new Vector2(19.339f, -3.665f); } } if (BetterAirShip.VitalsMedbay.GetValue()) { // Vitals GameObject Vitals = GameObject.Find("Medbay/panel_vitals"); Vitals.transform.position = new Vector2(24.55f, -4.780f); // Download Medbay GameObject MedbayDownload = GameObject.Find("Medbay/panel_data"); MedbayDownload.transform.position = new Vector2(25.240f, -7.938f); } if (BetterAirShip.CargoGas.GetValue()) { // Cargo gas GameObject Fuel = GameObject.Find("Storage/task_gas"); Fuel.transform.position = new Vector2(36.070f, 1.897f); } if (BetterAirShip.Divert.GetValue()) { // Divert GameObject DivertRecieve = GameObject.Find("HallwayMain/DivertRecieve"); DivertRecieve.transform.position = new Vector2(13.35f, -1.659f); } }
public bool PreBuild(MapAsset asset) { if (!asset.type.StartsWith("util-") || asset.type.StartsWith("util-vent") || asset.type.StartsWith("util-spawn") || asset.type == "util-room" || asset.type == "util-player" || asset.type == "util-cam") { return(true); } UtilData utilData = AssetDB.utils[asset.type]; // Object GameObject obj = new GameObject(asset.type); // Sprite Renderer SpriteRenderer spriteRenderer = obj.AddComponent <SpriteRenderer>(); spriteRenderer.sprite = utilData.SpriteRenderer.sprite; spriteRenderer.material = utilData.SpriteRenderer.material; obj.layer = (int)Layer.ShortObjects; // Console Action action; if (utilData.GameObj.GetComponent <SystemConsole>() != null) { SystemConsole origConsole = utilData.GameObj.GetComponent <SystemConsole>(); SystemConsole console = obj.AddComponent <SystemConsole>(); console.Image = spriteRenderer; console.FreeplayOnly = origConsole.FreeplayOnly; console.onlyFromBelow = asset.onlyFromBottom; console.usableDistance = origConsole.usableDistance; console.MinigamePrefab = origConsole.MinigamePrefab; if (asset.type == "util-cams2") // Convert Skeld Cams -> Polus/Airship Cams { console.MinigamePrefab = AssetDB.utils["util-cams"].GameObj.GetComponent <SystemConsole>().MinigamePrefab; } console.useIcon = origConsole.useIcon; action = console.Use; } else { MapConsole origConsole = utilData.GameObj.GetComponent <MapConsole>(); MapConsole console = obj.AddComponent <MapConsole>(); console.Image = spriteRenderer; console.useIcon = origConsole.useIcon; console.usableDistance = origConsole.usableDistance; console.useIcon = origConsole.useIcon; action = console.Use; } // Box Collider if (utilData.GameObj.GetComponent <CircleCollider2D>() != null) { CircleCollider2D origBox = utilData.GameObj.GetComponent <CircleCollider2D>(); CircleCollider2D box = obj.AddComponent <CircleCollider2D>(); box.radius = origBox.radius; box.offset = origBox.offset; box.isTrigger = true; } else if (utilData.GameObj.GetComponent <BoxCollider2D>() != null) { BoxCollider2D origBox = utilData.GameObj.GetComponent <BoxCollider2D>(); BoxCollider2D box = obj.AddComponent <BoxCollider2D>(); box.size = origBox.size; box.offset = origBox.offset; box.isTrigger = true; } else if (utilData.GameObj.GetComponent <PolygonCollider2D>() != null) { PolygonCollider2D origBox = utilData.GameObj.GetComponent <PolygonCollider2D>(); PolygonCollider2D box = obj.AddComponent <PolygonCollider2D>(); box.points = origBox.points; box.pathCount = origBox.pathCount; box.offset = origBox.offset; box.isTrigger = true; } // Button PassiveButton origBtn = utilData.GameObj.GetComponent <PassiveButton>(); PassiveButton btn = obj.AddComponent <PassiveButton>(); btn.ClickMask = origBtn.ClickMask; btn.OnMouseOver = new UnityEvent(); btn.OnMouseOut = new UnityEvent(); btn.OnClick.AddListener(action); // Colliders AssetHelper.BuildColliders(asset, obj); polus.Add(obj, asset); return(true); }
protected LivingCharacter(MapConsole map, Color foreground, Color background, int glyph) : base(map, foreground, background, glyph) { FOVSight = new GoRogue.FOV(map.MapToFOV); FOVLighted = new GoRogue.FOV(map.MapToFOV); }
public bool Build(MapAsset asset) { UtilData utilData = AssetDB.utils[asset.type]; // Object GameObject obj = new GameObject(asset.type); // Sprite Renderer SpriteRenderer spriteRenderer = obj.AddComponent <SpriteRenderer>(); spriteRenderer.sprite = utilData.SpriteRenderer.sprite; spriteRenderer.material = utilData.SpriteRenderer.material; // Console Action action; if (utilData.GameObj.GetComponent <SystemConsole>() != null) { SystemConsole origConsole = utilData.GameObj.GetComponent <SystemConsole>(); SystemConsole console = obj.AddComponent <SystemConsole>(); console.Image = spriteRenderer; console.FreeplayOnly = origConsole.FreeplayOnly; console.onlyFromBelow = origConsole.onlyFromBelow; console.usableDistance = origConsole.usableDistance; console.MinigamePrefab = origConsole.MinigamePrefab; console.useIcon = origConsole.useIcon; action = console.Use; } else { MapConsole origConsole = utilData.GameObj.GetComponent <MapConsole>(); MapConsole console = obj.AddComponent <MapConsole>(); console.Image = spriteRenderer; console.useIcon = origConsole.useIcon; console.usableDistance = origConsole.usableDistance; console.useIcon = origConsole.useIcon; action = console.Use; } // Box Collider if (utilData.GameObj.GetComponent <CircleCollider2D>() != null) { CircleCollider2D origBox = utilData.GameObj.GetComponent <CircleCollider2D>(); CircleCollider2D box = obj.AddComponent <CircleCollider2D>(); box.radius = origBox.radius; box.offset = origBox.offset; box.isTrigger = true; } else { BoxCollider2D origBox = utilData.GameObj.GetComponent <BoxCollider2D>(); BoxCollider2D box = obj.AddComponent <BoxCollider2D>(); box.size = origBox.size; box.offset = origBox.offset; box.isTrigger = true; } // Button PassiveButton origBtn = utilData.GameObj.GetComponent <PassiveButton>(); PassiveButton btn = obj.AddComponent <PassiveButton>(); btn.ClickMask = origBtn.ClickMask; btn.OnMouseOver = new UnityEvent(); btn.OnMouseOut = new UnityEvent(); btn.OnClick.AddListener(action); polus.Add(obj, asset); return(true); }
public static bool Prefix(MapConsole __instance) { return(MapOptions.canUseAdmin); }
public MapScreen() { mapConsole = new MapConsole(SadConsole.Global.CurrentScreen.Width, SadConsole.Global.CurrentScreen.Height, this); }