public override void Configure(IGame game, IServiceProvider serviceProvider) { _combatModule = (CombatModule)serviceProvider.GetService(typeof(IGameModule <CombatModule>)); _logger = (ILogger <RegenPlugin>)serviceProvider.GetService(typeof(ILogger <RegenPlugin>)); base.Configure(game, serviceProvider); }
/** * load module prefabs */ void LoadModules() { combatModulePrefabs = new Dictionary <ModuleType, CombatModule>(); constructionModulePrefabs = new Dictionary <ModuleType, ConstructionModule>(); var mods = Resources.LoadAll("Modules", typeof(GameObject)); foreach (GameObject obj in mods) { CombatModule mod = obj.GetComponent <CombatModule>(); if (mod != null) { ModuleType type = (ModuleType)mod.GetType().GetField("type").GetRawConstantValue(); combatModulePrefabs.Add(type, mod); continue; } ConstructionModule constructionMod = obj.GetComponent <ConstructionModule>(); if (constructionMod != null) { ModuleType type = (ModuleType)constructionMod.GetType().GetField("type").GetRawConstantValue(); constructionModulePrefabs.Add(type, constructionMod); continue; } } }
protected override void Awake() { base.Awake(); _combatModule = GetComponent <CombatModule>(); _stateManager = new PlatformerCharacterStateManager(this, _rollingDuration); _combatModule.OnAttackFinish += OnAttackFinishHandler; }
protected override void Awake() { base.Awake(); _combatModule = GetComponent <CombatModule>(); _stateManager = new MeleeEnemyControllerStateManager(this); _combatModule.OnAttackFinish += OnAttackFinishHandler; }
public override void Configure(IGame game, IServiceProvider serviceProvider) { base.Configure(game, serviceProvider); _logger = (ILogger <CombatPlugin>)serviceProvider.GetService(typeof(ILogger <CombatPlugin>)); _combatModule = (CombatModule)serviceProvider.GetService(typeof(IGameModule <CombatModule>)); _combatModule.AddedEncounter += HandleNewEncounter; _combatModule.RemovedEncounter += HandleRemoveEncounter; }
public Flow(CMD cmd, CombatModule combatModule, ConsumablesModule consumablesModule, Inventory inventory, Lua lua, NodeScanModule nodeScanModule, ObjectManager objectManager, PathModule pathModule, Spell spell) { CMD = cmd; CombatModule = combatModule; ConsumablesModule = consumablesModule; Inventory = inventory; Lua = lua; NodeScanModule = nodeScanModule; ObjectManager = objectManager; PathModule = pathModule; Spell = spell; }
protected void GetModules() { Modules = new Dictionary <string, NPCModule>(); foreach (KeyValuePair <string, string> entry in NPCModuleTypes) { NPCModule module = (NPCModule)GetComponent(entry.Value); Modules.Add(entry.Key, module); } ; combatModule = (CombatModule)Modules["Combat"]; movementModule = (MovementModule)Modules["Movement"]; bounceModule = (BounceModule)Modules["Bounce"]; handleOpponentModule = (HandleOpponentModule)Modules["HandleOpponent"]; visionModule = (VisionModule)Modules["Vision"]; }
void OnTriggerEnter(Collider other) { CombatModule mod = CombatModule.FindModule(other.gameObject); if (mod == null || mod.ship.isLerping) { return; } Ship ship = mod.ship; if (ship.planet == null) { StartCoroutine(LerpEnter(30f, .7f)); ship.planet = this; } }
void OnTriggerEnter(Collider other) { CombatModule mod = other.gameObject.GetComponent <CombatModule>(); if (mod != null && !mod.ship.isLerping) { Ship ship = mod.ship; ship.rigidbody.velocity = Vector3.zero; ship.rigidbody.angularVelocity = Vector3.zero; ship.constellation = constellation; ship.star = this; StartCoroutine(mod.ship.LerpPosition(transform.position, 1f)); StartCoroutine(mod.ship.LerpScale(new Vector3(.1f, .1f, .1f), 1f)); StartCoroutine(mod.ship.LerpRotation(new Vector3(0f, 0f, 360f * 3f), 1f, () => { ship.transform.position = Vector3.zero; game.Navigate(); })); // StartCoroutine(scene.cam.LerpSize(2f, 1f, () => game.ChangeScene("SolarSystem"))); } }
public Flow(CMD cmd, CombatModule combatModule, ConsumablesModule consumablesModule, Inventory inventory, Lua lua, MerchantModule merchantModule, NPCScanModule npcScanModule, ObjectManager objectManager, PathModule pathModule, Spell spell) { CMD = cmd; CombatModule = combatModule; ConsumablesModule = consumablesModule; Inventory = inventory; Lua = lua; MerchantModule = merchantModule; NPCScanModule = npcScanModule; ObjectManager = objectManager; PathModule = pathModule; Spell = spell; }
void Start() { physics = GetComponent <EntityPhysics>(); combatModule = GetComponent <CombatModule>(); //animator = GetComponent<Animator>(); playerInput = GetComponent <PlayerInput>(); runDustParticles.Stop(); landDustParticles.Stop(); jumpDustParticles.Stop(); turnaroundDustParticles.Stop(); wallJumpDustParticles.Stop(); currentNumberOfJumps = m_NumberOfJumpsInAir; currentNumberOfWallJumps = m_NumberOfWallJumps; currentNumberOfAirDodges = m_NumberOfAirDodges; wallJumpMask = LayerMask.GetMask("Environment", "CombatEnvironment"); p = ReInput.players.GetPlayer(playerNumber); //InitializeInputStructs(); SetupDictionaries(); LoadFrameData(); }
public void ExecuteFlow() { //if (ObjectManager.Target != null) //Common.Instance.DebugMessage(ObjectManager.Target.FactionId.ToString()); if (MerchantModule.NeedToVendor()) { MerchantModule.Vendoring = true; } if (ObjectManager.Player.IsInCombat) { CombatModule.Fight(); } else { var closestSkinnableNpc = NPCScanModule.ClosestSkinnableNPC(); var closestLootableNpc = NPCScanModule.ClosestLootableNPC(); if (!MerchantModule.Vendoring) { if (closestLootableNpc != null && GrinderDefault.CorpseLoot) { NPCScanModule.LootCorpse(closestLootableNpc); } else if (closestSkinnableNpc != null && GrinderDefault.CorpseLoot && GrinderDefault.CorpseSkin) { NPCScanModule.LootCorpse(closestSkinnableNpc); } else { if (CombatModule.IsReadyToFight()) { if (!CombatModule.IsBuffRequired()) { var closestCombattableNpc = NPCScanModule.ClosestCombattableNPC(); if (closestCombattableNpc != null && NPCScanModule.UnitInHotspots(closestCombattableNpc, PathModule.Hotspots, GrinderDefault.SearchRadius)) { CombatModule.Pull(closestCombattableNpc); } else { PathModule.Traverse(PathModule.GetNextHotspot()); } } else { CombatModule.Rebuff(); } } else { CombatModule.PrepareForFight(); } } } else { if (CombatModule.IsReadyToFight()) { if (!CombatModule.IsBuffRequired()) { var closestRepairNPC = NPCScanModule.RepairNPCFromProfile(); var closestCombattableNpcV = NPCScanModule.ClosestCombattableNPCV(); if (closestRepairNPC != null) { NPCScanModule.InteractWithVendor(closestRepairNPC); MerchantModule.RepairAndVendor(); } else { if (closestCombattableNpcV != null && NPCScanModule.UnitInHotspots(closestCombattableNpcV, PathModule.Vendor, GrinderDefault.SearchRadius)) { CombatModule.Pull(closestCombattableNpcV); } else { PathModule.Traverse(PathModule.GetNextVendorHotspot()); } } } else { CombatModule.Rebuff(); } } else { CombatModule.PrepareForFight(); } } } }
// Use this for initialization void Awake() { _animator = GetComponent <Animator>(); _platformerController = GetComponent <MainPlatformerController>(); _combatModule = GetComponent <CombatModule>(); }
public void ExecuteFlow() { closestNode = NodeScanModule.ClosestNode(); if (ObjectManager.Player.IsInCombat) { if (closestNode == null) { if (ObjectManager.Player.IsMounted) { PathModule.Traverse(PathModule.GetNextHotspot()); } if (!ObjectManager.Player.IsMounted) { if (CombatModule.EliteInCombatNPC() == null) { CombatModule.Fight(); } if (CombatModule.EliteInCombatNPC() != null) { PathModule.Traverse(PathModule.GetNextHotspot()); } } } if (closestNode != null) { nodeGuardian = NodeScanModule.NodeGuardian(closestNode); if (nodeGuardian != null) { if ((nodeGuardian.CreatureRank & Enums.CreatureRankTypes.Elite) == Enums.CreatureRankTypes.Elite || (nodeGuardian.CreatureRank & Enums.CreatureRankTypes.RareElite) == Enums.CreatureRankTypes.RareElite) { NodeScanModule.blacklist.Add(closestNode.Guid); return; } } if (ObjectManager.Player.IsMounted) { if (CombatModule.EliteInCombatNPC() == null) { Inventory.GetItem(ConsumablesModule.Mount().Name).Use(); } if (CombatModule.EliteInCombatNPC() != null) { PathModule.Traverse(NodeScanModule.ClosestNode().Position); } } if (!ObjectManager.Player.IsMounted) { if (CombatModule.EliteInCombatNPC() == null) { CombatModule.Fight(); } if (CombatModule.EliteInCombatNPC() != null) { PathModule.Traverse(NodeScanModule.ClosestNode().Position); } } } } if (!ObjectManager.Player.IsInCombat) { if (!CombatModule.IsReadyToFight()) { if (ObjectManager.Player.IsMounted) { Inventory.GetItem(ConsumablesModule.Mount().Name).Use(); } if (ConsumablesModule.Food() != null && ObjectManager.Player.HealthPercent < 60 && !ObjectManager.Player.GotAura("Food")) { Inventory.GetItem(ConsumablesModule.Food().Name).Use(); } if (ConsumablesModule.Drink() != null && ObjectManager.Player.ManaPercent < 60 && !ObjectManager.Player.GotAura("Drink")) { Inventory.GetItem(ConsumablesModule.Drink().Name).Use(); } } if (CombatModule.IsReadyToFight()) { if (closestNode == null) { if (ObjectManager.Player.CastingAsName == "Herb Gathering" || ObjectManager.Player.CastingAsName == "Mining") { Spell.StopCasting(); } if (!ObjectManager.Player.IsMounted && !CMD.mountDisabled && Inventory.GetItemCount(ConsumablesModule.Mount().Name) > 0 && !ObjectManager.Player.IsSwimming && ObjectManager.Player.CastingAsName == "") { Lua.Execute("DoEmote('stand')"); Inventory.GetItem(ConsumablesModule.Mount().Name).Use(); } if (ObjectManager.Player.IsMounted || Inventory.GetItemCount(ConsumablesModule.Mount().Name) == 0 || ObjectManager.Player.IsSwimming) { PathModule.Traverse(PathModule.GetNextHotspot()); } } if (closestNode != null) { nodeGuardian = NodeScanModule.NodeGuardian(closestNode); if (nodeGuardian != null) { if ((nodeGuardian.CreatureRank & Enums.CreatureRankTypes.Elite) == Enums.CreatureRankTypes.Elite || (nodeGuardian.CreatureRank & Enums.CreatureRankTypes.RareElite) == Enums.CreatureRankTypes.RareElite) { NodeScanModule.blacklist.Add(closestNode.Guid); return; } if (ObjectManager.Player.IsMounted) { Inventory.GetItem(ConsumablesModule.Mount().Name).Use(); } ObjectManager.Player.SetTarget(nodeGuardian); if (ObjectManager.Target == nodeGuardian) { CombatModule.Pull(ObjectManager.Target); } return; } if (closestNode.Position.DistanceToPlayer() > 3 && (ObjectManager.Player.CastingAsName == "Herb Gathering" || ObjectManager.Player.CastingAsName == "Mining")) { Spell.StopCasting(); } if (closestNode.Position.DistanceToPlayer() <= 3) { if (ObjectManager.Player.IsMounted) { Inventory.GetItem(ConsumablesModule.Mount().Name).Use(); } ObjectManager.Player.CtmStopMovement(); if (ObjectManager.Player.CastingAsName != "Herb Gathering" && ObjectManager.Player.CastingAsName != "Mining") { Lua.Execute("DoEmote('stand')"); closestNode.Interact(true); } return; } PathModule.Traverse(NodeScanModule.ClosestNode().Position); PathModule.index = -1; PathModule.playerPositions.Add(Convert.ToInt32(ObjectManager.Player.Position.X).ToString() + Convert.ToInt32(ObjectManager.Player.Position.Y).ToString() + Convert.ToInt32(ObjectManager.Player.Position.Z).ToString()); if (PathModule.Stuck()) { NodeScanModule.blacklist.Add(closestNode.Guid); PathModule.playerPositions.Clear(); ObjectManager.Player.Jump(); } } } } }