public void Name() { GameObjectManager m = new GameObjectManager(); var a = new GameObject(); // game object always have a default name. Assert.IsTrue(!string.IsNullOrEmpty(a.Name)); a.Name = "A"; m.Objects.Add(a); // Cannot change name of a game object that is already in a colleciton. Assert.Throws(typeof(InvalidOperationException), () => a.Name = "B"); // Cannot use "" or null for name. var b = new GameObject(); b.Name = ""; Assert.Throws(typeof(ArgumentException), () => m.Objects.Add(b)); b.Name = null; Assert.Throws(typeof(ArgumentException), () => m.Objects.Add(b)); // Cannot use duplicate name. var c = new GameObject(); c.Name = a.Name; Assert.Throws(typeof(ArgumentException), () => m.Objects.Add(c)); }
public void IsLoaded() { GameObjectManager m = new GameObjectManager(); var a = new MyGameObject { Name = "A" }; var aLoadCount = a.Properties.Get<int>("LoadCount"); var aUnLoadCount = a.Properties.Get<int>("UnLoadCount"); Assert.IsFalse(a.IsLoaded); Assert.AreEqual(0, aLoadCount.Value); Assert.AreEqual(0, aUnLoadCount.Value); m.Objects.Add(a); Assert.IsTrue(a.IsLoaded); Assert.AreEqual(1, aLoadCount.Value); Assert.AreEqual(0, aUnLoadCount.Value); a.Load(); // Does nothing. Assert.AreEqual(1, aLoadCount.Value); Assert.AreEqual(0, aUnLoadCount.Value); m.Objects.Remove(a); Assert.IsFalse(a.IsLoaded); Assert.AreEqual(1, aUnLoadCount.Value); a.Unload(); // Does nothing. Assert.AreEqual(1, aUnLoadCount.Value); }
/// <summary> /// Initializes a new instance of the BallerburgGame class /// </summary> public BallerburgGame() { Instance = this; gameSettings = new GameSettings(); playerSettings = new PlayerSettings[4]; applicationSettings = new ApplicationSettings(); graphics = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = 640, PreferredBackBufferHeight = 480 }; graphicsManager = new BallerburgGraphicsManager(); contentManager = new ContentManager(); shaderManager = new ShaderManager(); audioManager = new AudioManager(applicationSettings, contentManager); gameObjectManager = new GameObjectManager(contentManager, this.audioManager, this.graphicsManager); MousePointer = new MousePointer(this) { DrawOrder = 1000, RestrictZone = new Rectangle(0, 0, 640, 480) }; Components.Add(MousePointer); // Create the screen manager component. screenManager = new ScreenManager(graphicsManager, contentManager, gameObjectManager, applicationSettings, gameSettings, shaderManager, audioManager, playerSettings) { GameMousePointer = MousePointer }; }
public Panel(int[,] tiles) { Tiles = tiles; _gameObjectManager = new GameObjectManager(); _wallTexture = AssetManager.LoadTexture("wall"); _gameObjectManager.AddGameObject(Player.Instance); }
public void Initialize(GameObjectManager gameObjectManager, MessageManager messageManager) { this.ProcessManager = new ProcessManager(); this.GameObjectManager = gameObjectManager; this.MessageManager = messageManager; this.SceneGraph = new SceneGraph(messageManager); _pointerInputHandler = new PointerInputHandler(this.MessageManager, this.SceneGraph); _keyboardInputHandler = new KeyboardInputHandler(this.MessageManager); _soundManager = new SoundManager(this.MessageManager); // Initialize with current state (so previous state from previous view (like a mouse click) doesn't trigger again here) _pointerInputHandler.Update(new GameTime()); _keyboardInputHandler.Update(new GameTime()); OnInitialize(); }
public override void OnObjManagerAdd(GameObjectManager gom) { body = gom.Game.SprManager.GetSprite("armybody"); this.sprite = body; boundary = new Rectangle(0, 0, (int)(sprite.Width * scale), (int)(sprite.Height * scale)); center.X = body.Width / 2; center.Y = body.Height / 2; anchor = new Microsoft.Xna.Framework.Vector2(0f, 0f); //-- hnd gun frontHandAndGun = gom.Game.SprManager.GetSprite("handgun"); backHand = gom.Game.SprManager.GetSprite("backhand"); }
public void Update() { GameObjectManager m = new GameObjectManager(); m.Update(TimeSpan.FromSeconds(-0.1)); m.Update(TimeSpan.FromSeconds(0.1)); var a = new MyGameObject { Name = "A" }; var aUpdateCount = a.Properties.Get<int>("UpdateCount"); m.Objects.Add(a); Assert.AreEqual(0, aUpdateCount.Value); m.Update(TimeSpan.FromSeconds(0.1)); Assert.AreEqual(1, aUpdateCount.Value); m.Update(TimeSpan.FromSeconds(0.1)); Assert.AreEqual(2, aUpdateCount.Value); a.Update(TimeSpan.FromSeconds(0.1)); // Is ignored because NewFrame was not called. Assert.AreEqual(2, aUpdateCount.Value); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => QuestId == 65539 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65590 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65622 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 65964 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66053 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 66133 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66287 && Vector3.Distance(Core.Player.Location, XYZ) < InteractDistance && !actiontaken, new Sequence( new Action(r => { var targetnpc = GameObjectManager.GetObjectByNPCId((uint)NpcId); targetnpc.Target(); foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots) { if (slot.RawItemId == 2000975) { slot.UseItem(targetnpc); break; } } actiontaken = true; }), new Sleep(3, 5), new Decorator(ret => !Talk.DialogOpen, new Action(r => { actiontaken = false; }) ) ) ), new Decorator(ret => QuestId == 66426 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(2); }) ), new Decorator(ret => QuestId == 66493 && Vector3.Distance(Core.Player.Location, XYZ) < InteractDistance && !actiontaken, new Sequence( new Action(r => { var targetnpc = ff14bot.Managers.GameObjectManager.GetObjectByNPCId((uint)NpcId); targetnpc.Target(); foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots) { if (slot.RawItemId == 2000976) { slot.UseItem(targetnpc); actiontaken = true; } } }), new Sleep(3, 5), new Decorator(ret => !Talk.DialogOpen, new Action(r => { actiontaken = false; }) ) ) ), new Decorator(ret => QuestId == 66579 && Vector3.Distance(Core.Player.Location, XYZ) < InteractDistance && !actiontaken, new Sequence( new Action(r => { var targetnpc = ff14bot.Managers.GameObjectManager.GetObjectByNPCId((uint)NpcId); targetnpc.Target(); ChatManager.SendChat("/psych"); actiontaken = true; }), new Sleep(3, 5), new Decorator(ret => !Talk.DialogOpen, new Action(r => { actiontaken = false; }) ) ) ), new Decorator(ret => QuestId == 66584 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66642 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66693 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66694 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66724 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(ret => QuestId == 66740 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(1); }) ), new Decorator(ret => QuestId == 66979 && Vector3.Distance(Core.Player.Location, XYZ) < InteractDistance && !actiontaken, new Sequence( new Action(r => { var targetnpc = ff14bot.Managers.GameObjectManager.GetObjectByNPCId((uint)NpcId); targetnpc.Target(); ChatManager.SendChat("/soothe"); actiontaken = true; }), new Sleep(3, 5), new Decorator(ret => !Talk.DialogOpen, new Action(r => { actiontaken = false; }) ) ) ), new Decorator(ret => QuestId == 67138 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(0); }) ), new Decorator(ret => QuestId == 67405 && SelectString.IsOpen, new Action(r => { SelectString.ClickSlot(4); }) ), new Decorator(ret => QuestId == 67670 && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), base.CreateBehavior() )); }
protected override void onProcess(int familiesUpdateCount) { foreach (GameObject entity in _cells) { Cell cell = entity.GetComponent <Cell>(); // If a pathogene entered in the cell, the cell state is changed to INFECTED // We also add components that will indicate the cell can be eaten by macrophages if (cell.state.Equals(CellState.HEALTHY) && cell.infections.Count > 0) { cell.state = CellState.INFECTED; GameObjectManager.addComponent <Eatable>(entity, new { eatableMask = INFECTED_EATABLE_LAYER }); } // If the cell is infected, we have to replicate all pathogenes, resulting in consuming resources // Resources are represented as the cell's health WithHealth healthComponent = entity.GetComponent <WithHealth>(); if (cell.state.Equals(CellState.INFECTED)) { int i = 0; while (healthComponent.health > 1 && i < cell.infections.Count) { GameObject go = cell.infections[i].prefab; Infectious infectious = go.GetComponent <Infectious>(); // Decrease cooldown infectious.cooldown -= Time.deltaTime; if (infectious.cooldown < 0) { // Replicate once cell.infections[i].nb++; cell.infections[i].originalNb++; healthComponent.health -= infectious.replicationCost; // Reset cooldown infectious.cooldown = infectious.replicationTime; } ++i; } // If the is no more resources, the cell is about to die if (healthComponent.health <= 0) { cell.state = CellState.DEAD; } } // The cell is about to die, the factory is created if (cell.state.Equals(CellState.DEAD)) { // Create the factory GameObject obj = new GameObject(); obj.transform.position = entity.transform.position; // Configure the factory Factory factory = obj.AddComponent <Factory>(); factory.rate = DEFAULT_RATE; factory.entries = cell.infections; factory.useRandomSpawning = true; // Bind it to FYFY GameObjectManager.bind(obj); // Set all prefab as children of the created factory : they will be removed when the factory will desappear too. foreach (FactoryEntry entry in cell.infections) { entry.prefab.transform.SetParent(obj.transform); } // Die GameObjectManager.addComponent <Removed>(entity); } } }
/// <summary> /// Initializes a new instance of the <see cref="AD_Mode"/> class. /// </summary> /// <param name="orbwalker">The orbwalker.</param> public AD_Mode(GameObjectManager gameObjectManager) : base(gameObjectManager) { }
public void Figth(GameObject go) { GameObjectManager.loadScene(Global.data.currentPlayScene.ToString()); }
public static void SkillAttackAnim(this GameUI gameUI, JsonData actionInfo, string logPrefix) { var myTurn = gameUI.GameState.MyTurn; var actionFish = (int)actionInfo["ActionFish"]; void Subtle() { if (!myTurn) { gameUI.GameState.EnemyUsedSkills[actionFish].Add("无作为技能"); } var myselfRecover = UnityEngine.Object.Instantiate(gameUI.recoverEffect, gameUI.allFishRoot); myselfRecover.localPosition = GameObjectManager.FishRelativePosition(!myTurn, actionFish); gameUI.SetTimeout(() => { UnityEngine.Object.Destroy(myselfRecover.gameObject); }, 4000); if (SharedRefs.Mode == Constants.GameMode.Online && !myTurn) { gameUI.AddLog($"{logPrefix}己方使用了无作为技能。"); return; } var friendId = actionFish; for (var i = 0; i < 4; i++) { if ((!myTurn || !gameUI.GameState.MyFishSelectedAsTarget[i]) && (myTurn || !gameUI.GameState.EnemyFishSelectedAsTarget[i])) { continue; } friendId = i; break; } var shield = UnityEngine.Object.Instantiate(gameUI.shieldEffect, gameUI.allFishRoot); shield.localPosition = GameObjectManager.FishRelativePosition(!myTurn, friendId); gameUI.SetTimeout(() => { UnityEngine.Object.Destroy(shield.gameObject); }, 5000); gameUI.AddLog($"{logPrefix}己方{friendId}号位置的鱼使用了无作为技能。"); } switch ((string)actionInfo["skill"]["type"]) { case "aoe": { if (!myTurn) { gameUI.GameState.EnemyUsedSkills[actionFish].Add("AOE"); } var targetList = actionInfo["skill"]["targets"]; var ids = new List <string>(); for (var i = 0; i < targetList.Count; i++) { var id = (int)actionInfo["skill"]["targets"][i]["pos"]; ids.Add(id.ToString()); gameUI.SetTimeout(() => { var originalDistance = GameObjectManager.FishRelativePosition(myTurn, id) - GameObjectManager.FishRelativePosition(!myTurn, actionFish); var targetFishId = (myTurn ? gameUI.GameState.EnemyFishId : gameUI.GameState.MyFishId)[id]; var bias = targetFishId == 4 ? new Vector3(4f, 0, 0) : new Vector3(3f, 0, 0); var distance = originalDistance + (originalDistance.x < 0 ? 1 : -1) * bias; var angle = Math.Atan(distance.x / distance.z) / Math.PI * 180.0; UnityEngine.Object.Instantiate( gameUI.waterProjectile, GameObjectManager.FishRelativePosition(!myTurn, actionFish) + new Vector3(3, 0, 0) * (myTurn ? -1 : 1), Quaternion.Euler( new Vector3( 0, Convert.ToInt32(myTurn ? angle < 0 ? angle : angle - 180.0 : angle > 0 ? angle : angle + 180.0), 0 ) ) ); }, i * 120); } gameUI.AddLog( $"{logPrefix}{(gameUI.GameState.MyTurn ? GameUI.EnemyStr : GameUI.MeStr)}{string.Join(",", ids)}号位置的鱼发起了AOE攻击。" ); if (SharedRefs.Mode == Constants.GameMode.Offline && (myTurn ? gameUI.GameState.MyFishSelectedAsTarget : gameUI.GameState.EnemyFishSelectedAsTarget) .Any(b => b)) { Subtle(); } break; } case "infight": { if (!myTurn) { gameUI.GameState.EnemyUsedSkills[actionFish].Add("伤害队友"); } var target = (int)actionInfo["skill"]["targets"][0]["pos"]; var myFishExplode = UnityEngine.Object.Instantiate(gameUI.bigExplosion, gameUI.allFishRoot); myFishExplode.localPosition = GameObjectManager.FishRelativePosition(!myTurn, target); gameUI.SetTimeout(() => { UnityEngine.Object.Destroy(myFishExplode.gameObject); }, 2000); var myFishRecover = UnityEngine.Object.Instantiate(gameUI.recoverEffect, gameUI.allFishRoot); myFishRecover.localPosition = GameObjectManager.FishRelativePosition(!myTurn, actionFish); gameUI.SetTimeout(() => { UnityEngine.Object.Destroy(myFishRecover.gameObject); }, 4000); gameUI.AddLog($"{logPrefix}伤害了己方{target}号位置队友。"); break; } case "crit": { if (!myTurn) { gameUI.GameState.EnemyUsedSkills[actionFish].Add("暴击"); } var target = (int)actionInfo["skill"]["targets"][0]["pos"]; var distance = GameObjectManager.FishRelativePosition(!myTurn, actionFish) - GameObjectManager.FishRelativePosition(myTurn, target); gameUI.Repeat(cnt => { (myTurn ? gameUI.Gom.MyFishTransforms : gameUI.Gom.EnemyFishTransforms) [actionFish].localPosition = GameObjectManager.FishRelativePosition(myTurn, target) + Math.Abs(cnt - 5f) / 5f * distance; }, () => { }, 11, 0, 40); gameUI.SetTimeout(() => { var targetExplode = UnityEngine.Object.Instantiate(gameUI.explodePrefab, gameUI.allFishRoot); targetExplode.localPosition = GameObjectManager.FishRelativePosition(myTurn, target); gameUI.SetTimeout(() => { UnityEngine.Object.Destroy(targetExplode.gameObject); }, 1000); }, 200); gameUI.AddLog( $"{logPrefix}{(gameUI.GameState.MyTurn ? GameUI.EnemyStr : GameUI.MeStr)}{target}号位置的鱼发起了暴击伤害。" ); if (SharedRefs.Mode == Constants.GameMode.Offline && (myTurn ? gameUI.GameState.MyFishSelectedAsTarget : gameUI.GameState.EnemyFishSelectedAsTarget) .Any(b => b)) { Subtle(); } break; } case "subtle": { Subtle(); break; } } if (SharedRefs.Mode == Constants.GameMode.Online && !myTurn && !gameUI.GameState.EnemyFishExpose[actionFish]) { GameObjectManager.UpdateHiddenExtension(gameUI, actionFish); } }
public async Task <bool> GetToGatherNpc() { if (WorldManager.ZoneId != ZoneId && WorldManager.ZoneId != 886) { while (Core.Me.IsCasting) { await Coroutine.Sleep(1000); } if (!ConditionParser.HasAetheryte(AetheryteId)) { //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. You don't have that Aetheryte so do something about it..."); //TreeRoot.Stop(); return(false); } if (!WorldManager.TeleportById(AetheryteId)) { //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. something is very wrong..."); //TreeRoot.Stop(); return(false); } while (Core.Me.IsCasting) { await Coroutine.Sleep(1000); } if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } await Coroutine.Wait(10000, () => WorldManager.ZoneId == FoundationZoneId); await Coroutine.Sleep(3000); await Coroutine.Wait(10000, () => GameObjectManager.GetObjectByNPCId(70) != null); await Coroutine.Sleep(3000); var unit = GameObjectManager.GetObjectByNPCId(70); if (!unit.IsWithinInteractRange) { var _target = unit.Location; Navigator.PlayerMover.MoveTowards(_target); while (!unit.IsWithinInteractRange) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); } unit.Target(); unit.Interact(); await Coroutine.Sleep(1000); await Coroutine.Wait(5000, () => SelectString.IsOpen); await Coroutine.Sleep(500); if (SelectString.IsOpen) { SelectString.ClickSlot(1); } await Coroutine.Sleep(5000); if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } await Coroutine.Sleep(3000); } //await CommonTasks.MoveTo(Npc.Location, "Moving To HandinVendor"); if (GatherNpc.Location.Distance(Core.Me.Location) > 5f) { var _target = new Vector3(-21.62485f, -16f, 141.3661f); Navigator.PlayerMover.MoveTowards(_target); while (_target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); _target = GatherNpc.Location; Navigator.PlayerMover.MoveTowards(_target); while (_target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); } return(Npc.Location.Distance(Core.Me.Location) <= 5f); }
protected Composite Q67124() { // (67124) Heavensward - At the end of Our Hope Vector3 c1 = new Vector3(175.0911f, 130.9083f, -430.1f); Vector3 c2 = new Vector3(362.1796f, 137.2033f, -383.6978f); Vector3 c3 = new Vector3(444.7922f, 160.8083f, -566.6742f); return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 67124 && GameObjectManager.GetObjectByNPCId(2005850) != null && GameObjectManager.GetObjectByNPCId(2005850).IsVisible&& !Core.Player.InCombat, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005850).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2005850).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005850).Location, 3) ) ), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 5, new Action(a => { CheckPointReached(1); })), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(1), CommonBehaviors.MoveAndStop(ret => c1, 3)), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(2) && Core.Me.Location.Distance(c2) < 5, new Action(a => { CheckPointReached(2); })), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(2), CommonBehaviors.MoveAndStop(ret => c2, 3)), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(3) && Core.Me.Location.Distance(c3) < 3, new Action(a => { CheckPointReached(3); })), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(3), CommonBehaviors.MoveAndStop(ret => c3, 3)), base.CreateBehavior() )); }
void OnEnable() { gameObjectManager = target as GameObjectManager; }
public async Task <bool> Run() { //we are inside POTD if (Constants.InDeepDungeon || Constants.InExitLevel) { return(false); } if (WorldManager.ZoneId != Constants.RubySeaZoneID || Core.Me.Distance2D(Constants.KyuseiNpcPosition) > 110) { if (Core.Me.IsCasting) { await Coroutine.Sleep(500); return(true); } if (!WorldManager.TeleportById(106)) { Logger.Error("We can't get to The Ruby Sea. something is very wrong..."); TreeRoot.Stop(); return(false); } Logger.Verbose("Still Teleporting"); await Coroutine.Sleep(3000); return(true); } if (GameObjectManager.GetObjectByNPCId(Constants.KyuseiNpcId) == null || Constants.KyuseiNpcPosition.Distance2D(Core.Me.Location) > 5f) { // var moving = MoveResult.GeneratingPath; // while (!(moving == MoveResult.Done || // moving == MoveResult.ReachedDestination || // moving == MoveResult.Failed || // moving == MoveResult.Failure || // moving == MoveResult.PathGenerationFailed)) // { // moving = Flightor.MoveTo(new FlyToParameters(GameObjectManager.GetObjectByNPCId(Constants.KyuseiNpcId).Location)); // // await Coroutine.Yield(); // } Logger.Verbose("at Move"); if (GameObjectManager.GetObjectByNPCId(Constants.KyuseiNpcId) != null) { return(await CommonTasks.MoveAndStop( new MoveToParameters(GameObjectManager.GetObjectByNPCId(Constants.KyuseiNpcId).Location, "Moving toward NPC"), 5f, true)); } return(await CommonTasks.MoveAndStop( new MoveToParameters(Constants.KyuseiNpcPosition, "Moving toward NPC"), 5f, true)); //return await CommonTasks.MoveAndStop(new MoveToParameters(Constants.KyuseiNpcPosition, "Moving toward NPC"), 5f, true); } return(false); }
protected Composite Q67137() { // (67137) Heavensward - Keeping the Flame Alive return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 67137 && GameObjectManager.GetObjectByNPCId(2005546) != null && GameObjectManager.GetObjectByNPCId(2005546).IsVisible&& !Core.Player.InCombat, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005546).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2005546).Interact(); CheckPointReached(1); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005546).Location, 3) ) ), new Decorator(ret => QuestId == 67137 && GameObjectManager.GetObjectByNPCId(2006332) != null && GameObjectManager.GetObjectByNPCId(2006332).IsVisible&& !Core.Player.InCombat && HasCheckPointReached(1), new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006332).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2006332).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006332).Location, 3) ) ), base.CreateBehavior() )); }
// Use this for initialization void Start() { manager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <GameObjectManager>(); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => !ConditionCheck(), new Action(ret => _done = true)), new Decorator(ret => Talk.DialogOpen, new Action(r => { Talk.Next(); }) ), new Decorator(ret => casted, new Sequence( new Sleep(3, 5), new Action(r => casted = false) ) ), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished, new Action(ret => _done = true)), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance, new PrioritySelector( new Decorator(ret => ActionManager.InSpellInRangeLOS(1, GameObjectManager.GetObjectByNPCId(NPC)) == Enums.SpellRangeCheck.ErrorNotInLineOfSight, CommonBehaviors.MoveToLos(r => GameObjectManager.GetObjectByNPCId(NPC), true) ), new Decorator(ret => true, new Action(r => { if (Core.Player.IsMounted) { ActionManager.Dismount(); } Navigator.PlayerMover.MoveStop(); if (!Core.Player.IsCasting) { ActionManager.DoActionLocation(Enums.ActionType.KeyItem, ItemID, XYZ); casted = true; } }) ) ) ), CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name) )); }
public UIBase CreateItem(GameObject itemObj, GameObject parent, bool isActive) { GameObject item = GameObjectManager.CreateGameObjectByPool(itemObj, parent, isActive); return(SetItem(item)); }
// Load our static. void Awake() { instance = this; }
/// <summary> /// Initializes a new instance of the <see cref="Support_Mode"/> class. /// </summary> /// <param name="orbwalker">The orbwalker.</param> public Support_Mode(GameObjectManager gameeObjectManager) : base(gameeObjectManager) { _orbwalkerModeLogic = new SupportModeOrbLogic(); _supportModeEventLogic = new SupportModeEventLogic(); _supportModeWeavingLogic = new SupportModeWeavingLogic(); }
void Menu() { GameObjectManager.loadScene("Menu"); }
// Use to process your families. protected override void onProcess(int familiesUpdateCount) { // Vérifier s'il faut générer une nouvelle journée if (time.newDay) { float newSpent = 0; // Gestion de la fermeture des frontières if (frontierPermeability.currentState >= 1) { newSpent += Random.Range(50000f, 150000f); // 100 000 € de perte en moyenne du à l'arrêt du tourisme } if (frontierPermeability.currentState >= 2) { newSpent += Random.Range(500000f, 1500000f); // 1 000 000 € de perte supplémentaire en moyenne du à l'arrêt du commerce hors zone europe } if (frontierPermeability.currentState >= 3) { newSpent += Random.Range(200000f, 600000f); // 400 000 € de perte supplémentaire en moyenne du au confinement total } float remoteworkingImpact = (remoteworking.currentState ? 0.75f : 1f); // si activation du télétravail baisse l'impact financier dû à une activité à domicile float shortTimeWorkingImpact = (shortTimeWorking.currentState ? 100f : 1f); // si activation du chômage partiel fait exploser l'impact financier dû aux charges sociales foreach (GameObject territory in f_territories) { TerritoryData territoryData = territory.GetComponent <TerritoryData>(); // Chiffres INSEE : 30Md en 2 mois pour un scénario avec télétravail (0.75f) + chômage partiel (10f) => donc par jour ça donne : 30Md / 2 mois / 30 jours / (100 * 0.75) = 6 666 666 € => arrondi à 6 000 000 € et à pondérer en fonction de la proportion de la population dans la région // Gestion de la fermeture des boutiques if (territoryData.closeShop) { territoryData.closeShopDynamic = Mathf.Min(1, territoryData.closeShopDynamic + 0.1f); newSpent += territoryData.closeShopDynamic * territoryData.populationRatio * Random.Range(4000000f, 8000000f) * remoteworkingImpact * shortTimeWorkingImpact; // 6 Million de perte par jour dû au ralentissement de l'économie modulé par les actions sociales. } else { territoryData.closeShopDynamic = Mathf.Max(0, territoryData.closeShopDynamic - 0.1f); } // Gestion du confinement par age (si la tranche d'age concerne des travailleurs) if (territoryData.ageDependent && territoryData.ageDependentMin != "" && territoryData.ageDependentMax != "" && int.Parse(territoryData.ageDependentMin) < 62 && int.Parse(territoryData.ageDependentMax) >= 62) { int ageMin = int.Parse(territoryData.ageDependentMin); int ageMax = int.Parse(territoryData.ageDependentMax); // Une partie de la population en confinement total est en age de travailler => Calcul de la proportion de la population de la région concernée int workerConfined = 0; for (int age = ageMin; age <= ageMax && age < 62; age++) { workerConfined += territoryData.popNumber[age] - territoryData.popDeath[age]; } newSpent += workerConfined / (countryPopData.nbPopulation - countryPopData.nbDeath) * Random.Range(500000f, 1500000f) * remoteworkingImpact * shortTimeWorkingImpact; // 1 Million de perte par jour dû au ralentissement de l'économie modulé par les actions sociales } } // Gestion des impôts des entreprises if (tax.currentState) { taxProgress = Mathf.Min(1, taxProgress + 0.1f); newSpent += taxProgress * Random.Range(100000000f, 7000000000f); // 42 Milliards en deux mois (chiffre INSEE) => 700 Millions par jour max } else { taxProgress = Mathf.Max(0, taxProgress - 0.1f); } // Calcul du coup financier d'une journée d'un lit de réa newSpent += Mathf.Min(beds.intensiveBeds_need, beds.intensiveBeds_current) * finances.oneDayReanimationCost; if (!bedsNotif && beds.intensiveBeds_need > 0) { bedsNotif = true; GameObjectManager.addComponent <ChatMessage>(finances.gameObject, new { sender = "Rapport des hopitaux publics", timeStamp = "" + time.daysGone, messageBody = "Une journée de réanimation coûte " + finances.oneDayReanimationCost.ToString("N0", CultureInfo.CreateSpecificCulture("fr-FR")) + "€ pour chaque patient." }); } // prise en compte des financement extérieurs à ce système (achats de masques et de vaccins en l'occurence) newSpent += finances.dailySpending; finances.dailySpending = 0; if (newSpent != 0) { stability = false; } float newDebt = finances.historySpent[finances.historySpent.Count - 1] + newSpent; if (newDebt > nextStepNotif) { string messageChosen = ""; switch (Random.Range(0, 4)) { case 0: messageChosen = "L'opposition s'inquiète de l'accumulation de la dette !!!"; break; case 1: messageChosen = "La dette du pays dû à la crise atteind " + newDebt.ToString("N0", CultureInfo.CreateSpecificCulture("fr-FR")) + " €. Pour information la dette nationale avant la crise était de 2 500 Md€."; break; case 2: messageChosen = "Pourrons-nous soutenir ce rythme des mesures encore longtemps ?"; break; case 3: messageChosen = "Avec ce rythme des dépenses, le pays mettra des années à s'en relever."; break; } GameObjectManager.addComponent <ChatMessage>(finances.gameObject, new { sender = "Ministre de l'économie", timeStamp = "" + time.daysGone, messageBody = messageChosen }); nextStepNotif *= 10; } finances.historySpent.Add(newDebt); if (!stability && finances.historySpent[finances.historySpent.Count - 1] == finances.historySpent[Mathf.Max(0, finances.historySpent.Count - 10)]) { GameObjectManager.addComponent <ChatMessage>(finances.gameObject, new { sender = "Ministre de l'économie", timeStamp = "" + time.daysGone, messageBody = "Cela fait plusieurs jours que les dépenses sont maîtrisées, continuons ainsi." }); stability = true; } } }
//private GameObject UseItemTarget => GameObjectManager.GetObjectByNPCId(InteractNpcId); //private BagSlot Item => UseItem ? InventoryManager.FilledSlots.FirstOrDefault(r => r.RawItemId == ItemIds.FirstOrDefault()) : null; protected override Composite CreateBehavior() { return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed() ), new Decorator(r => Talk.DialogOpen && SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); }) ), new Decorator(r => Request.IsOpen, new Action(r => { var items = InventoryManager.FilledInventoryAndArmory.ToArray(); for (int i = 0; i < ItemIds.Length; i++) { BagSlot item; item = items.FirstOrDefault(z => z.RawItemId == ItemIds[i] && !usedSlots.Contains(z)); if (item == null) { LogError($"We don't have any items with an id of {ItemIds[i]}."); } else { item.Handover(); usedSlots.Add(item); } } usedSlots.Clear(); Request.HandOver(); }) ), new Decorator(r => Core.Player.HasTarget && UseItem && !doneUseItem, new Action(r => { var targetNpc = GameObjectManager.GetObjectByNPCId(InteractNpcId); foreach (BagSlot slot in InventoryManager.FilledSlots) { if (slot.RawItemId == ItemIds.FirstOrDefault()) { Log($"Using {slot.EnglishName} on {targetNpc.EnglishName}."); slot.UseItem(targetNpc); } } if (Core.Player.IsCasting) { doneUseItem = true; } if (SelectYesno.IsOpen) { doneUseItem = true; } }) ), new Decorator(ret => HasInteractObjects && DutyManager.InInstance && !Core.Player.InCombat && InteractableTarget != null, new PrioritySelector( new Decorator(ret => Core.Player.Location.Distance(InteractableTarget.Location) <= 5, new Action(r => { InteractableTarget.Interact(); }) ), new Decorator(ret => Core.Player.Location.Distance(InteractableTarget.Location) > 5, CommonBehaviors.MoveAndStop(ret => InteractableTarget.Location, 3) ), new ActionAlwaysSucceed() ) ), new Decorator(ret => HasCheckpoints && DutyManager.InInstance, new PrioritySelector( new Decorator(ret => Core.Player.Location.Distance(CurrentCheckpoint) < 5, new Action(r => { Checkpoints.Remove(Checkpoints.First()); }) ), new Decorator(ret => Core.Player.Location.Distance(CurrentCheckpoint) > 5, CommonBehaviors.MoveAndStop(ret => CurrentCheckpoint, 3) ) ) ), base.CreateBehavior() )); }
public void onFamilyEnter(GameObject gameObject) { GameObjectManager.dontDestroyOnLoadAndRebind(gameObject); }
private async Task <bool> FindNode(bool retryCenterHotspot = true) { if (Node != null) { return(false); } StatusText = Localization.ExGather_SearchForNodes; while (Behaviors.ShouldContinue) { IEnumerable <GatheringPointObject> nodes = GameObjectManager.GetObjectsOfType <GatheringPointObject>().Where(gpo => gpo.CanGather).ToArray(); if (GatherStrategy == GatherStrategy.TouchAndGo && HotSpots != null) { if (GatherObjects != null) { nodes = nodes.Where(gpo => GatherObjects.Contains(gpo.EnglishName, StringComparer.InvariantCultureIgnoreCase)); } foreach (var node in nodes.Where(gpo => HotSpots.CurrentOrDefault.WithinHotSpot2D(gpo.Location)) .OrderBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)) .Skip(1)) { if (!Blacklist.Contains(node.ObjectId, BlacklistFlags.Interact)) { Blacklist.Add( node, BlacklistFlags.Interact, TimeSpan.FromSeconds(18), Localization.ExGather_SkipFurthestNodes); } } } nodes = nodes.Where(gpo => !Blacklist.Contains(gpo.ObjectId, BlacklistFlags.Interact)); if (FreeRange) { nodes = nodes.Where(gpo => gpo.Distance2D(ExProfileBehavior.Me.Location) < Radius); } else { if (HotSpots != null) { nodes = nodes.Where(gpo => HotSpots.CurrentOrDefault.WithinHotSpot2D(gpo.Location)); } } // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression if (GatherObjects != null) { Node = nodes.OrderBy( gpo => GatherObjects.FindIndex(i => string.Equals(gpo.EnglishName, i, StringComparison.InvariantCultureIgnoreCase))) .ThenBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)) .FirstOrDefault(gpo => GatherObjects.Contains(gpo.EnglishName, StringComparer.InvariantCultureIgnoreCase)); } else { Node = nodes.OrderBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)).FirstOrDefault(); } if (Node == null) { if (HotSpots != null) { var myLocation = ExProfileBehavior.Me.Location; var distanceToFurthestVisibleGameObject = GameObjectManager.GameObjects.Select(o => o.Location.Distance2D(myLocation)) .OrderByDescending(o => o) .FirstOrDefault(); var distanceToFurthestVectorInHotspot = myLocation.Distance2D(HotSpots.CurrentOrDefault) + HotSpots.CurrentOrDefault.Radius; if (myLocation.Distance2D(HotSpots.CurrentOrDefault) > Radius && GatherStrategy == GatherStrategy.GatherOrCollect && retryCenterHotspot && distanceToFurthestVisibleGameObject <= distanceToFurthestVectorInHotspot) { Logger.Verbose(Localization.ExGather_DistanceObject + distanceToFurthestVisibleGameObject); Logger.Verbose(Localization.ExGather_DistanceHotSpot + distanceToFurthestVectorInHotspot); Logger.Warn( Localization.ExGather_NoAvailableNode); await HotSpots.CurrentOrDefault.XYZ.MoveTo(radius : Radius, name : HotSpots.CurrentOrDefault.Name); retryCenterHotspot = false; await Coroutine.Yield(); continue; } if (!await ChangeHotSpot()) { retryCenterHotspot = false; await Coroutine.Yield(); continue; } } if (FreeRange && !FreeRangeConditional()) { await Coroutine.Yield(); isDone = true; return(true); } return(true); } var entry = Blacklist.GetEntry(Node.ObjectId); if (entry != null && entry.Flags.HasFlag(BlacklistFlags.Interact)) { Logger.Warn(Localization.ExGather_NodeBlacklist); if (await Coroutine.Wait(entry.Length, () => entry.IsFinished || Node.Location.Distance2D(ExProfileBehavior.Me.Location) > Radius) || Core.Player.IsDead) { if (!entry.IsFinished) { Node = null; Logger.Info(Localization.ExGather_NodeReset); return(false); } } Logger.Info(Localization.ExGather_NodeBlacklistRemoved); } Logger.Info(Localization.ExGather_NodeSet + Node); if (HotSpots == null) { MovementManager.SetFacing2D(Node.Location); } if (Poi.Current.Unit != Node) { Poi.Current = new Poi(Node, PoiType.Gather); } return(true); } return(true); }
private void optimizeQuality() { // Set specific quality settings if (QualitySettings.GetQualityLevel() == 0) { Graphics.activeTier = UnityEngine.Rendering.GraphicsTier.Tier1; foreach (GameObject vlrGo in f_vlr) { vlrGo.GetComponent <VolumetricLightRenderer>().enabled = false; } foreach (GameObject ppGo in f_postProcessBehaviour) { ppGo.GetComponent <PostProcessingBehaviour>().profile = f_postProcessProfiles.First().GetComponent <PostProcessingProfiles>().bank[0]; } // disable reflect in first room GameObjectManager.setGameObjectState(f_reflectionProbe.First(), false); // disable particles foreach (GameObject partGo in f_particles) { if (!partGo.GetComponentInParent <DreamFragment>()) // do not touch DreamFragment { GameObjectManager.setGameObjectState(partGo, false); } } } else if (QualitySettings.GetQualityLevel() == 1) { Graphics.activeTier = UnityEngine.Rendering.GraphicsTier.Tier2; foreach (GameObject vlrGo in f_vlr) { vlrGo.GetComponent <VolumetricLightRenderer>().enabled = false; } foreach (GameObject ppGo in f_postProcessBehaviour) // use for the First Person Character post process of the main Menu camera { ppGo.GetComponent <PostProcessingBehaviour>().profile = f_postProcessProfiles.First().GetComponent <PostProcessingProfiles>().bank[1]; } // enable reflect in first room GameObjectManager.setGameObjectState(f_reflectionProbe.First(), true); foreach (GameObject partGo in f_particles) { if (partGo.name.Contains("Poussiere particule")) // disable particles of the first room { GameObjectManager.setGameObjectState(partGo, false); } else if (!partGo.GetComponentInParent <DreamFragment>()) // do not touch DreamFragment { GameObjectManager.setGameObjectState(partGo, true); } } } else if (QualitySettings.GetQualityLevel() == 2) { Graphics.activeTier = UnityEngine.Rendering.GraphicsTier.Tier3; foreach (GameObject vlrGo in f_vlr) { vlrGo.GetComponent <VolumetricLightRenderer>().enabled = true; } foreach (GameObject ppGo in f_postProcessBehaviour) { ppGo.GetComponent <PostProcessingBehaviour>().profile = f_postProcessProfiles.First().GetComponent <PostProcessingProfiles>().bank[2]; } // enable reflect in first room GameObjectManager.setGameObjectState(f_reflectionProbe.First(), true); // enable particles foreach (GameObject partGo in f_particles) { if (!partGo.GetComponentInParent <DreamFragment>()) // do not touch DreamFragment { GameObjectManager.setGameObjectState(partGo, true); } } } }
/// <summary> /// Creates a new GameObject. /// </summary> /// <param name="id">The unique id for this GameObject.</param> public GameObject(string id) { this.id = id; GameObjectManager.AddGameObject(this); transform = Matrix.Identity; }
// Use to process your families. protected override void onProcess(int familiesUpdateCount) { foreach (GameObject go in _triggeredGO) { Triggered2D t2d = go.GetComponent <Triggered2D>(); Predator predator = go.GetComponent <Predator>(); Eat eat = go.GetComponent <Eat>(); eat.timeSinceLastEffect += Time.deltaTime; bool effectApplied = false; foreach (GameObject target in t2d.Targets) { if (_preysGO.contains(target.GetInstanceID())) { Prey prey = target.GetComponent <Prey>(); if (predator.myPreys.Contains(prey.myType)) { //"eat" the target Transform collidedTr = target.GetComponent <Transform>(); Health collidedH = target.GetComponent <Health>(); if (eat.timeSinceLastEffect >= eat.effectFreq) { collidedH.healthPoints -= eat.damage; if (collidedH.healthPoints <= 0) { Vector3 pos = target.transform.position; if (eat.infectOnKill) { //Debug.Log(pos); prey.myType = eat.newPreyTag; GameObjectManager.addComponent <Infected>(target, new { myParasit = go }); GameObjectManager.addComponent <Factory>(target, new { reloadTime = eat.timerFactory, prefab = eat.prefab }); collidedH.healthPoints = collidedH.maxHealthPoints; Energizer collidedE = target.GetComponent <Energizer>(); Energizer e = go.GetComponent <Energizer>(); if (collidedE != null) { if (e != null) { collidedE.recoverPoints = e.recoverPoints; collidedE.reloadTime = e.reloadTime; } else { GameObjectManager.removeComponent(collidedE); } } else { if (e != null) { GameObjectManager.addComponent <Energizer>(target, new { recoverPoints = e.recoverPoints, reloadTime = e.reloadTime }); } } if (eat.applyColor) { Renderer r = target.GetComponentInChildren <Renderer>(); if (r != null) { if (r is SpriteRenderer) { ((SpriteRenderer)r).color = eat.color; } else { r.material.color = eat.color; } } } } else { GameObjectManager.unbind(target); Object.Destroy(target); } Move mv = go.GetComponent <Move>(); if (mv != null) { mv.targetObject = null; } /* Previous functionnality of duplication on kill * / * GameObject myDuplicate = Object.Instantiate<GameObject>(eat.prefab, pos, Quaternion.Euler(0f, 0f, Random.Range(0f, 360f))); * * //WARNING: should not do that but looks like that even if instance come frome a prefab, it is instanciated with a Triggered2D... * //If this line is commented, FYFY will generate an error * Object.Destroy(myDuplicate.GetComponent<Triggered2D>()); * * GameObjectManager.bind(myDuplicate); * * Move mv = myDuplicate.GetComponent<Move>(); * if (mv != null) { * Vector2 posTarget = new Vector2(Random.Range(pos.x - 1f, pos.x + 1f), Random.Range(pos.y -1f, pos.y -1f)); * * mv.targetPosition = posTarget; * mv.forcedTarget = true; * mv.newTargetPosition = true; * } * /* */ } effectApplied = true; } } } } if (effectApplied) { eat.timeSinceLastEffect = 0f; } } }
/// <summary></summary> public override void OnInspectorGUI() { serializedObject.Update(); _fixedUpdateDrawingList.DoLayoutList(); _updateDrawingList.DoLayoutList(); _lateUpdateDrawingList.DoLayoutList(); if (!Application.isPlaying) { EditorGUILayout.Space(); string[] options = new string[] { "Do not bind specified Game Objects on Start", "Bind only specified Game Objects on Start", }; int newValue = EditorGUILayout.Popup("", _loadingState.intValue, options); if (newValue != _loadingState.intValue) { _loadingState.intValue = newValue; } EditorGUI.indentLevel += 1; for (int i = 0; i < _specialGameObjects.arraySize; i++) { GameObject currentGO = (GameObject)_specialGameObjects.GetArrayElementAtIndex(i).objectReferenceValue; if (currentGO == null) { _specialGameObjects.DeleteArrayElementAtIndex(i); i--; } else { GameObject updatedGO = (GameObject)EditorGUILayout.ObjectField(currentGO, typeof(GameObject), true); _specialGameObjects.GetArrayElementAtIndex(i).objectReferenceValue = updatedGO; } } _specialGameObjects.InsertArrayElementAtIndex(0); _specialGameObjects.GetArrayElementAtIndex(0).objectReferenceValue = (GameObject)EditorGUILayout.ObjectField(null, typeof(GameObject), true); EditorGUI.indentLevel -= 1; string newWrapperPath = EditorGUILayout.DelayedTextField(new GUIContent("Wrappers directory", "The path where wrappers are stored."), _outputWrappers.stringValue); if (newWrapperPath != _outputWrappers.stringValue) { if (EditorUtility.DisplayDialog("Warning", "If you change FYFY wrappers' directory, all events linked with systems' functions will be lost. Are you sure to continue?", "Yes, remove old directory", "Cancel")) { // remove all wrappers List <MonoBehaviour> currentsComponents = new List <MonoBehaviour>(((MainLoop)target).GetComponents <MonoBehaviour>()); foreach (MonoBehaviour currentComponent in currentsComponents) { if (currentComponent != null) { // Check if current component is a system wrapper Type componentType = currentComponent.GetType(); if (componentType.FullName.EndsWith("_wrapper")) { DestroyImmediate(currentComponent); // Because we are in editmode, we don't use GameObjectManager } } } // remove directory if (Directory.Exists(_outputWrappers.stringValue)) { Directory.Delete(_outputWrappers.stringValue, true); } if (File.Exists(_outputWrappers.stringValue + ".meta")) { File.Delete(_outputWrappers.stringValue + ".meta"); } _outputWrappers.stringValue = newWrapperPath; UnityEngine.Debug.Log("Refresh Data base"); AssetDatabase.Refresh(); } else { _outputWrappers.stringValue = _outputWrappers.stringValue; // reset value } } } else { MainLoop ml = (MainLoop)target; // init monitor if required if (_systemsMonitor == null) { _systemsMonitor = new SystemsMonitor(HISTORY_DATA_LENGTH); _fixedUpdateStatsHistory = new Queue <float> (new float[HISTORY_DATA_LENGTH]); _updateStatsHistory = new Queue <float> (new float[HISTORY_DATA_LENGTH]); _lateUpdateStatsHistory = new Queue <float> (new float[HISTORY_DATA_LENGTH]); } if (!EditorApplication.isPaused) { _fixedUpdateStatsHistory.Dequeue(); _fixedUpdateStatsHistory.Enqueue(ml.fixedUpdateStats); _updateStatsHistory.Dequeue(); _updateStatsHistory.Enqueue(ml.updateStats); _lateUpdateStatsHistory.Dequeue(); _lateUpdateStatsHistory.Enqueue(ml.lateUpdateStats); } EditorGUILayout.Space(); ml.showSystemProfiler = EditorGUILayout.Foldout(ml.showSystemProfiler, "FSystem profiler (ms)"); if (ml.showSystemProfiler) { _systemsMonitor.Draw(_fixedUpdateStatsHistory.ToArray(), _updateStatsHistory.ToArray(), _lateUpdateStatsHistory.ToArray(), 100f); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Bind tools"); EditorGUI.indentLevel += 1; GameObject tmp = null; tmp = EditorGUILayout.ObjectField(new GUIContent("Bind Game Object:", "Drag&Drop a game object you want to dynamically bind."), tmp, typeof(UnityEngine.Object), true) as GameObject; if (tmp != null) { if (GameObjectManager._gameObjectWrappers.ContainsKey(tmp.GetInstanceID())) { EditorUtility.DisplayDialog("Invalid operation", tmp.name + " is already binded to Fyfy", "Ok", ""); } else { GameObjectManager.bind(tmp); } } tmp = null; tmp = EditorGUILayout.ObjectField(new GUIContent("Unbind Game Object:", "Drag&Drop a game object you want to dynamically unbind."), tmp, typeof(UnityEngine.Object), true) as GameObject; if (tmp != null) { if (!GameObjectManager._gameObjectWrappers.ContainsKey(tmp.GetInstanceID())) { EditorUtility.DisplayDialog("Invalid operation", tmp.name + " is not currently binded to Fyfy", "Ok", ""); } else { GameObjectManager.unbind(tmp); } } EditorGUI.indentLevel -= 1; EditorGUILayout.Space(); ml.showFamilyInspector = EditorGUILayout.Foldout(ml.showFamilyInspector, "Families inspector"); if (ml.showFamilyInspector) { EditorGUI.indentLevel += 1; ml.showFamilyInspectorFixedUpdate = EditorGUILayout.Foldout(ml.showFamilyInspectorFixedUpdate, "FixedUpdate"); if (ml.showFamilyInspectorFixedUpdate) { displayFamilies(FSystemManager._fixedUpdateSystems); } ml.showFamilyInspectorUpdate = EditorGUILayout.Foldout(ml.showFamilyInspectorUpdate, "Update"); if (ml.showFamilyInspectorUpdate) { displayFamilies(FSystemManager._updateSystems); } ml.showFamilyInspectorLateUpdate = EditorGUILayout.Foldout(ml.showFamilyInspectorLateUpdate, "LateUpdate"); if (ml.showFamilyInspectorLateUpdate) { displayFamilies(FSystemManager._lateUpdateSystems); } EditorGUI.indentLevel -= 1; } this.Repaint(); } serializedObject.ApplyModifiedProperties(); }
public static void UpdateAllies(Action extensions = null) { CastableParty.Clear(); ClearCastable(); if (!Globals.InParty) { if (Globals.InGcInstance) { CastableParty.Add(Core.Me); foreach (var ally in GameObjectManager.GetObjectsOfType <BattleCharacter>().Where(r => !r.CanAttack)) { //if (!ally.IsTargetable || !ally.InLineOfSight() || ally.Icon == PlayerIcon.Viewing_Cutscene) //TODO: This is a temporary fix for wrong PlayerIcon Enum: 15 = Viewing_Cutscene if (!ally.IsTargetable || !ally.InLineOfSight() || ally.Icon == (PlayerIcon)15) { continue; } if (BaseSettings.Instance.PartyMemberAuraHistory) { UpdatePartyMemberHistory(ally); } CastableParty.Add(ally); } } } foreach (var ally in PartyManager.RawMembers.Select(r => r.BattleCharacter)) { if (ally == null) { continue; } if (BaseSettings.Instance.DebugHealingListsPrintToLog == true) { Logger.WriteInfo($@"[Debug] PartyManager {ally.Name} is a valid Party Member in PartyManager."); } //if (!ally.IsTargetable || !ally.InLineOfSight() || ally.Icon == PlayerIcon.Viewing_Cutscene) //TODO: This is a temporary fix for wrong PlayerIcon Enum: 15 = Viewing_Cutscene if (!ally.IsTargetable || !ally.InLineOfSight() || ally.Icon == (PlayerIcon)15) { continue; } if (BaseSettings.Instance.PartyMemberAuraHistory) { UpdatePartyMemberHistory(ally); } if (WorldManager.InPvP) { if (ally.HasAura(Auras.MountedPvp)) { continue; } } CastableParty.Add(ally); } /*if (CastableParty.Count() < PartyManager.NumMembers) * { * Logger.WriteInfo("Mismatch in Castable Party Count:"); * Logger.WriteInfo($"CastableParty: {String.Join(", ",CastableParty.Select(x => x.Name))}"); * Logger.WriteInfo($"PartyManager: {String.Join(", ",PartyManager.AllMembers.Select(x => x.Name))}"); * }*/ foreach (var ally in CastableParty.OrderBy(a => a.GetHealingWeight())) { AddAllyToCastable(ally); } extensions?.Invoke(); }
private async Task <bool> Main() { if (Core.Player.IsMounted) { await CommonTasks.StopAndDismount(); } if (Core.Player.InCombat) { await Coroutine.Wait(5000, () => !Core.Player.InCombat); return(true); } await Coroutine.Sleep(Delay); if (GearSet > 0) { if (GearsetManager.ActiveGearset.Index == GearSet) { Log("Desired Gearset is already active"); _done = true; return(false); } foreach (var gs in GearsetManager.GearSets) { if (gs.Index == GearSet) { Log($"Changing your Gearset to {gs.Class}."); gs.Activate(); } } } if (Aura > 0) { string thisAura = null; var auraId = Core.Player.GetAuraById((uint)Aura); if (Core.Player.HasAura((uint)Aura)) { thisAura = auraId.LocalizedName; } else { _done = true; return(false); } Log($"Removing Aura {thisAura}."); ChatManager.SendChat("/statusoff \"" + thisAura + "\""); } if (DoAction != null) { Log($"Using {DoAction} on Player."); ChatManager.SendChat("/ac \"" + DoAction + "\" <me>"); } if (DoActionTarget != null) { Log($"Using {DoActionTarget} on Current Target."); ChatManager.SendChat("/ac \"" + DoActionTarget + "\" <target>"); } if (Say != null) { Log($"Saying {Say}."); ChatManager.SendChat("/s " + Say); } if (Emote != null) { if (NpcId > 0) { var obj = GameObjectManager.GetObjectByNPCId((uint)NpcId); Log($"Targeting {obj.EnglishName}."); obj.Target(); } Log($"Using the {Emote} Emote."); ChatManager.SendChat("/" + Emote); } if (QuestItem > 0 && XYZ != null) { BagSlot item = InventoryManager.FilledSlots.FirstOrDefault(r => r.RawItemId == QuestItem); Log($"Using {item.EnglishName} on {XYZ.ToString()}."); ActionManager.DoActionLocation(Enums.ActionType.KeyItem, (uint)QuestItem, XYZ); await Coroutine.Wait(10000, () => !Core.Player.IsCasting); } await Coroutine.Sleep(Delay); if (QuestId > 0 && StepId > 0) { return(false); } else { _done = true; } return(false); }
public async Task <bool> GetToVendorNpc() { if (WorldManager.ZoneId != ZoneId && WorldManager.ZoneId != 886) { while (Core.Me.IsCasting) { await Coroutine.Sleep(1000); } if (!ConditionParser.HasAetheryte(AetheryteId)) { Logger.LogCritical("We can't get to Foundation. You don't have that Aetheryte so do something about it..."); TreeRoot.Stop(); return(false); } if (!WorldManager.TeleportById(AetheryteId)) { Logger.LogCritical($"We can't get to {AetheryteId}. something is very wrong..."); TreeRoot.Stop(); return(false); } while (Core.Me.IsCasting) { await Coroutine.Sleep(1000); } if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } await Coroutine.Wait(10000, () => WorldManager.ZoneId == FoundationZoneId); await Coroutine.Sleep(3000); await Coroutine.Wait(10000, () => GameObjectManager.GetObjectByNPCId(70) != null); await Coroutine.Sleep(3000); var unit = GameObjectManager.GetObjectByNPCId(70); if (!unit.IsWithinInteractRange) { var _target = unit.Location; Navigator.PlayerMover.MoveTowards(_target); while (!unit.IsWithinInteractRange) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); } unit.Target(); unit.Interact(); await Coroutine.Sleep(1000); await Coroutine.Wait(5000, () => SelectString.IsOpen); await Coroutine.Sleep(500); if (SelectString.IsOpen) { SelectString.ClickSlot(1); } await Coroutine.Sleep(5000); if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } await Coroutine.Sleep(3000); } if (!(VendorNpc.Location.Distance(Core.Me.Location) > 5f)) { return(Npc.Location.Distance(Core.Me.Location) <= 5f); } var target = new Vector3(10.58188f, -15.96282f, 163.8702f); Navigator.PlayerMover.MoveTowards(target); while (target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(target); await Coroutine.Sleep(100); } Navigator.PlayerMover.MoveStop(); target = VendorNpc.Location; Navigator.PlayerMover.MoveTowards(target); while (target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(target); await Coroutine.Sleep(100); } //await CommonTasks.MoveTo(VendorNpc.Location, "Moving To HandinVendor"); // await CommonTasks.MoveAndStop( // new MoveToParameters(VendorNpc.Location, "Moving To HandinVendor"), 2f); Navigator.PlayerMover.MoveStop(); return(Npc.Location.Distance(Core.Me.Location) <= 5f); }
void Awake() { mInstance = this; }
public async Task <bool> GetToNpc() { if (WorldManager.ZoneId != ZoneId && WorldManager.ZoneId != 886) { while (Core.Me.IsCasting) { await Coroutine.Sleep(1000); } if (!ConditionParser.HasAetheryte(AetheryteId)) { //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. You don't have that Aetheryte so do something about it..."); //TreeRoot.Stop(); return(false); } if (!WorldManager.TeleportById(AetheryteId)) { //Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. something is very wrong..."); //TreeRoot.Stop(); return(false); } while (Core.Me.IsCasting) { await Coroutine.Sleep(1000); } if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } await Coroutine.Wait(10000, () => WorldManager.ZoneId == FoundationZoneId); await Coroutine.Sleep(3000); await Coroutine.Sleep(3000); var unit = GameObjectManager.GetObjectByNPCId(70); unit.Interact(); await Coroutine.Sleep(1000); await Coroutine.Wait(5000, () => SelectString.IsOpen); await Coroutine.Sleep(500); if (SelectString.IsOpen) { SelectString.ClickSlot(1); } await Coroutine.Sleep(5000); if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } await Coroutine.Sleep(3000); } /* if (GameObjectManager.GetObjectByNPCId(NpcId) != null) * await CommonTasks.MoveAndStop( * new MoveToParameters(GameObjectManager.GetObjectByNPCId(NpcId).Location, * "Moving toward NPC"), 5f, true);*/ if (GameObjectManager.GetObjectByNPCId(NpcId).Location.Distance(Core.Me.Location) > 5f) { var _target = new Vector3(10.58188f, -15.96282f, 163.8702f); Navigator.PlayerMover.MoveTowards(_target); while (_target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } //await Buddy.Coroutines.Coroutine.Sleep(1500); // (again, probably better to just wait until distance to destination is < 2.0f or something) Navigator.PlayerMover.MoveStop(); _target = GameObjectManager.GetObjectByNPCId(NpcId).Location; Navigator.PlayerMover.MoveTowards(_target); while (_target.Distance2D(Core.Me.Location) >= 4) { Navigator.PlayerMover.MoveTowards(_target); await Coroutine.Sleep(100); } //await Buddy.Coroutines.Coroutine.Sleep(1500); // (again, probably better to just wait until distance to destination is < 2.0f or something) Navigator.PlayerMover.MoveStop(); } return(GameObjectManager.GetObjectByNPCId(NpcId).Location.Distance(Core.Me.Location) <= 5f); }
void Awake() { _Instance = this; DontDestroyOnLoad(gameObject); }
internal GameObject(GameObjectManager manager, Texture2D texture, Vector2 position) : this(manager, texture, position, Vector2.Zero) { }
public override void OnObjManagerAdd(GameObjectManager gom) { base.OnObjManagerAdd(gom); rotatorObj.OnObjManagerAdd(gom); }