コード例 #1
0
        public ResearchAction(int sequence, int frame, IPlayer player, TechType techType)
            : base(sequence, frame, player)
        {
            this.TechType = techType;

            ActionType = ActionType.Research;
        }
コード例 #2
0
 public ThermalCharger(TechType tier2Id2, SubRoot cyclops)
     : base(TechType.CyclopsThermalReactorModule, tier2Id2, cyclops)
 {
 }
コード例 #3
0
        /// <summary>
        /// Allows you to set the tooltip of a specific <see cref="TechType"/>.
        /// </summary>
        /// <param name="techType">The <see cref="TechType"/> whose tooltip that is to be changed.</param>
        /// <param name="text">The new tooltip for the chosen <see cref="TechType"/>.</param>
        void ILanguageHandler.SetTechTypeTooltip(TechType techType, string text)
        {
            string modName = ReflectionHelper.CallingAssemblyNameByStackTrace();

            LanguagePatcher.AddCustomLanguageLine(modName, $"Tooltip_{techType.AsString()}", text);
        }
コード例 #4
0
 /// <summary>
 /// Creates a new ModSprite to be used with a specific TechType.
 /// Created with a UnityEngine Sprite.
 /// </summary>
 /// <param name="type">The techtype paired to this sprite.</param>
 /// <param name="sprite">The sprite to be added.</param>
 public ModSprite(TechType type, UnityEngine.Sprite sprite) : this(type, new Atlas.Sprite(sprite, false))
 {
 }
コード例 #5
0
ファイル: PlayerImpl.cs プロジェクト: Omnigazer/StarcraftBot
 public override bool isResearchAvailable(TechType tech) {
   bool ret = bwapiclientPINVOKE.PlayerImpl_isResearchAvailable(swigCPtr, TechType.getCPtr(tech));
   if (bwapiclientPINVOKE.SWIGPendingException.Pending) throw bwapiclientPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #6
0
ファイル: Unit.cs プロジェクト: Omnigazer/StarcraftBot
 public virtual bool research(TechType tech) {
   bool ret = bwapiPINVOKE.Unit_research(swigCPtr, TechType.getCPtr(tech));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #7
0
ファイル: TechType.cs プロジェクト: Omnigazer/StarcraftBot
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TechType obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: Omnigazer/StarcraftBot
 public virtual bool isResearchAvailable(TechType tech) {
   bool ret = bwapiPINVOKE.Player_isResearchAvailable(swigCPtr, TechType.getCPtr(tech));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #9
0
 public bool add(TechType techType) => techTypes.Add(techType);
コード例 #10
0
 public RemotePlayerEquipmentRemoved(ushort playerId, TechType techType)
 {
     PlayerId = playerId;
     TechType = techType;
 }
コード例 #11
0
 public static void AddColdResistance(TechType techType, int newValue)
 {
     //AddJsonProperty(techType, "coldResistance", new JsonValue(newValue));
     CraftDataHandler.SetColdResistance(techType, newValue);
 }
コード例 #12
0
 public static void AddJsonProperty(TechType techType, string key, JsonValue newValue)
 {
     addJsonPropertyInfo.Invoke(null, new object[] { techType, key, newValue });
 }
コード例 #13
0
 internal static float GetDiveSuitTempBonus(TechType suit)
 {
     return(suitTemperatureResistance.GetOrDefault(suit, 0f));
 }
コード例 #14
0
 internal static void AddModTechType(TechType tech, GameObject prefab = null)
 {
     TechTypeUtils.AddModTechType(tech, prefab);
 }
コード例 #15
0
 internal static void AddSubstitution(TechType custom, TechType vanilla)
 {
     EquipmentPatch.AddSubstitution(custom, vanilla);
     PlayerPatch.AddSubstitution(custom, vanilla);
 }
コード例 #16
0
ファイル: WeaponType.cs プロジェクト: Omnigazer/StarcraftBot
 public TechType getTech() {
   TechType ret = new TechType(bwapiPINVOKE.WeaponType_getTech(swigCPtr), true);
   return ret;
 }
コード例 #17
0
 /// <summary>
 /// Returns true if there is enough resources required to research the given tech type.
 /// </summary>
 /// <param name="techType"></param>
 /// <returns></returns>
 public static bool CanResearch(TechType techType) {
     return SWIG.BWAPI.bwapi.Broodwar.canResearch(null, techType.BwapiObject);
 }
コード例 #18
0
 public bool remove(TechType techType) => techTypes.Remove(techType);
コード例 #19
0
ファイル: UnitType.cs プロジェクト: Omnigazer/StarcraftBot
 public TechType requiredTech() {
   TechType ret = new TechType(bwapiPINVOKE.UnitType_requiredTech(swigCPtr), true);
   return ret;
 }
コード例 #20
0
 public bool contains(TechType techType) => techTypes.Contains(techType);
コード例 #21
0
ファイル: Unit.cs プロジェクト: Omnigazer/StarcraftBot
 public virtual bool useTech(TechType tech, Unit target) {
   bool ret = bwapiPINVOKE.Unit_useTech__SWIG_2(swigCPtr, TechType.getCPtr(tech), Unit.getCPtr(target));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #22
0
 protected override void SetStaticTechTypeID(TechType techTypeID) => NuclearChargerID = techTypeID;
コード例 #23
0
 public override bool research(TechType tech) {
   bool ret = bwapiclientPINVOKE.UnitImpl_research(swigCPtr, TechType.getCPtr(tech));
   if (bwapiclientPINVOKE.SWIGPendingException.Pending) throw bwapiclientPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #24
0
ファイル: KnownTechEntry.cs プロジェクト: joeeyaura/Nitrox
        public void Add(TechType techType, bool verbose)
        {
            KnownTechEntryAdd EntryAdd = new KnownTechEntryAdd(techType.ToDto(), verbose);

            packetSender.Send(EntryAdd);
        }
コード例 #25
0
ファイル: UnitCommand.cs プロジェクト: Omnigazer/StarcraftBot
 public static UnitCommand useTech(Unit unit, TechType tech, Unit target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_useTech__SWIG_2(Unit.getCPtr(unit), TechType.getCPtr(tech), Unit.getCPtr(target)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #26
0
        private static void MakeSnacksPlaceable()
        {
            GameObject snack1 = Resources.Load <GameObject>("WorldEntities/Food/Snack1");

            if (snack1 != null)
            {
                BoxCollider snack1Collider = snack1.AddComponent <BoxCollider>();
                snack1Collider.size = new Vector3(0.17f, 0.18f, 0.8f);
                MakeItemPlaceable(TechType.Snack1, snack1, snack1Collider);
            }
#if DEBUG_ITEMS_REGISTRATION
            else
            {
                Logger.Log("WARNING: Could not load type[{0}]", "WorldEntities/Food/Snack1");
            }
#endif
            GameObject snack2 = Resources.Load <GameObject>("WorldEntities/Food/Snack2");
            if (snack2 != null)
            {
                BoxCollider snack2Collider = snack2.AddComponent <BoxCollider>();
                snack2Collider.size = new Vector3(0.17f, 0.18f, 0.8f);
                MakeItemPlaceable(TechType.Snack2, snack2, snack2Collider);
            }
#if DEBUG_ITEMS_REGISTRATION
            else
            {
                Logger.Log("WARNING: Could not load type [{0}]", "WorldEntities/Food/Snack2");
            }
#endif
            GameObject snack3 = Resources.Load <GameObject>("WorldEntities/Food/Snack3");
            if (snack3 != null)
            {
                BoxCollider snack3Collider = snack3.AddComponent <BoxCollider>();
                snack3Collider.size = new Vector3(0.17f, 0.18f, 0.8f);
                MakeItemPlaceable(TechType.Snack3, snack3, snack3Collider);
            }
#if DEBUG_ITEMS_REGISTRATION
            else
            {
                Logger.Log("WARNING: Could not load type [{0}]", "WorldEntities/Food/Snack3");
            }
#endif

            // Swap Snack2 and Snack3 techtypes (as tooltips do not match models)
            if (snack2 != null && snack3 != null)
            {
                var    snack2PrefabId = snack2.GetComponent <PrefabIdentifier>();
                var    snack3PrefabId = snack3.GetComponent <PrefabIdentifier>();
                var    snack2TechTag  = snack2.GetComponent <TechTag>();
                var    snack3TechTag  = snack3.GetComponent <TechTag>();
                string tmpclassid     = snack2PrefabId.ClassId;
                snack2PrefabId.ClassId = snack3PrefabId.ClassId;
                snack3PrefabId.ClassId = tmpclassid;
                string tmpname = snack2PrefabId.name;
                snack2PrefabId.name = snack3PrefabId.name;
                snack3PrefabId.name = tmpname;
                TechType tmpTechType = snack2TechTag.type;
                snack2TechTag.type = snack3TechTag.type;
                snack3TechTag.type = tmpTechType;
            }
        }
コード例 #27
0
 /// <summary>
 /// Allows you to set the tooltip of a specific <see cref="TechType"/>.
 /// </summary>
 /// <param name="techType">The <see cref="TechType"/> whose tooltip that is to be changed.</param>
 /// <param name="text">The new tooltip for the chosen <see cref="TechType"/>.</param>
 public static void SetTechTypeTooltip(TechType techType, string text)
 {
     Main.SetTechTypeTooltip(techType, text);
 }
コード例 #28
0
        private static void MakeMaterialPlaceable(TechType materialTechType, string materialPath)
        {
            GameObject mat = Resources.Load <GameObject>(materialPath);

            if (mat != null)
            {
                if (materialTechType == TechType.FiberMesh)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <FiberMesh_PT>();
                }
                else if (materialTechType == TechType.AramidFibers)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <AramidFibers_PT>();
                }
                else if (materialTechType == TechType.SeaTreaderPoop)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <SeaTreaderPoop_PT>();
                }
                else if (materialTechType == TechType.Diamond)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Diamond_PT>();
                }
                else if (materialTechType == TechType.Lithium)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Lithium_PT>();
                }
                else if (materialTechType == TechType.Magnetite)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Magnetite_PT>();
                }
                else if (materialTechType == TechType.Nickel)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Nickel_PT>();
                }
                else if (materialTechType == TechType.Quartz)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Quartz_PT>();
                }
                else if (materialTechType == TechType.Sulphur)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Sulphur_PT>();
                }
                else if (materialTechType == TechType.Glass)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Glass_PT>();
                }
                else if (materialTechType == TechType.EnameledGlass)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <EnameledGlass_PT>();
                }
                else if (materialTechType == TechType.PlasteelIngot)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <PlasteelIngot_PT>();
                }
                else if (materialTechType == TechType.Silicone)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Silicone_PT>();
                }
                else if (materialTechType == TechType.CopperWire)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <CopperWire_PT>();
                }
                else if (materialTechType == TechType.Silver)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Silver_PT>();
                }
                else if (materialTechType == TechType.Gold)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Gold_PT>();
                }
                else if (materialTechType == TechType.Salt)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Salt_PT>();
                }
                else if (materialTechType == TechType.BloodOil)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <BloodOil_PT>();
                }
                else if (materialTechType == TechType.Titanium)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Titanium_PT>();
                }
                else if (materialTechType == TechType.Lead)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Lead_PT>();
                }
                else if (materialTechType == TechType.UraniniteCrystal)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <UraniniteCrystal_PT>();
                }
                else if (materialTechType == TechType.Kyanite)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Kyanite_PT>();
                }
                else if (materialTechType == TechType.JeweledDiskPiece)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <JeweledDiskPiece_PT>();
                }
                else if (materialTechType == TechType.AluminumOxide)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <AluminumOxide_PT>();
                }
                else if (materialTechType == TechType.CoralChunk)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <CoralChunk_PT>();
                }
                else if (materialTechType == TechType.Copper)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <Copper_PT>();
                }
                else if (materialTechType == TechType.TitaniumIngot)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <TitaniumIngot_PT>();
                }
                else if (materialTechType == TechType.CrashPowder)
                {
                    mat.AddComponent <CustomPlaceToolController>();
                    mat.AddComponent <CrashPowder_PT>();
                }
                MakeItemPlaceable(materialTechType, mat);
            }
#if DEBUG_ITEMS_REGISTRATION
            else
            {
                Logger.Log("WARNING: Could not load type [{0}]", materialPath);
            }
#endif
        }
コード例 #29
0
ファイル: Eat.cs プロジェクト: gurrenm3/Stats-Core
        /// <summary>
        /// This is a copy paste of the original <see cref="Survival.Eat(GameObject)"/> because there are too many things to transpile
        /// </summary>
        /// <param name="__instance"></param>
        /// <param name="useObj"></param>
        private void NewPrefixPatch(Survival __instance, GameObject useObj)
        {
            bool flag = false;

            if (useObj != null)
            {
                Eatable component = useObj.GetComponent <Eatable>();
                if (component != null)
                {
                    bool flag2 = component.maxCharges == 0 || component.charges > 0;
                    if (component.GetFoodValue() != 0f && flag2)
                    {
                        if (__instance.food <= __instance.GetStomachSize() - 1)
                        {
                            __instance.food = Mathf.Clamp(__instance.food + component.GetFoodValue(), __instance.GetMinStomachSize(), __instance.GetStomachOverfillSize());
                        }
                        __instance.onEat.Trigger(component.GetFoodValue());
                        if (component.GetFoodValue() > 0f)
                        {
                            GoalManager.main.OnCustomGoalEvent("Eat_Something");
                        }
                        result = component.removeOnUse;
                        flag   = true;
                    }
                    if (component.GetWaterValue() != 0f && flag2)
                    {
                        __instance.water = Mathf.Clamp(__instance.water + component.GetWaterValue(), __instance.GetMinWater(), __instance.GetWaterOverfillSize());
                        __instance.onDrink.Trigger(component.GetWaterValue());
                        if (component.GetWaterValue() > 0f)
                        {
                            GoalManager.main.OnCustomGoalEvent("Drink_Something");
                        }
                        result = component.removeOnUse;
                        flag   = true;
                    }
                    float healthValue = component.GetHealthValue();
                    if (healthValue != 0f && flag2)
                    {
                        if (healthValue > 0f)
                        {
                            __instance.liveMixin.AddHealth(healthValue);
                            GoalManager.main.OnCustomGoalEvent("Heal_Damage");
                        }
                        else if (healthValue <= -1f)
                        {
                            __instance.liveMixin.TakeDamage(-healthValue, default(Vector3), DamageType.FoodPoison, null);
                        }
                        result = component.removeOnUse;
                        flag   = true;
                    }
                    float coldMeterValue = component.GetColdMeterValue();
                    if (coldMeterValue != 0f && flag2)
                    {
                        __instance.bodyTemperature.AddCold(coldMeterValue);
                        result = component.removeOnUse;
                        flag   = true;
                    }
                    if (!__instance.InConversation() && ((__instance.food > __instance.GetLowFoodThreshold() && __instance.food - component.GetFoodValue() < __instance.GetLowFoodThreshold()) || (__instance.water > __instance.GetLowWaterThreshold() && __instance.water - component.GetWaterValue() < __instance.GetLowWaterThreshold())))
                    {
                        __instance.vitalsOkNotification.Play();
                    }
                }
                if (flag)
                {
                    TechType techType = CraftData.GetTechType(useObj);
                    if (techType == TechType.None)
                    {
                        Pickupable component2 = useObj.GetComponent <Pickupable>();
                        if (component2)
                        {
                            techType = component2.GetTechType();
                        }
                    }
                    FMODAsset useSound = __instance.player.GetUseSound(TechData.GetSoundType(techType));
                    if (useSound)
                    {
                        Utils.PlayFMODAsset(useSound, __instance.player.transform.position, 20f);
                    }
                    if (component.IsRotten())
                    {
                        Utils.PlayFMODAsset(__instance.ateRottenFoodSound, __instance.player.transform.position, 20f);
                    }
                    if (techType == TechType.Bladderfish)
                    {
                        Player.main.GetComponent <OxygenManager>().AddOxygen(__instance.GetO2FromBlatterfish());
                    }
                    if (component.maxCharges > 0)
                    {
                        component.ConsumeCharge();
                    }
                }
            }
        }
コード例 #30
0
 public EquippedItemData(string containerGuid, string guid, byte[] serializedData, string slot, TechType techType) : base(containerGuid, guid, serializedData)
 {
     Slot     = slot;
     TechType = techType;
 }
コード例 #31
0
 public Atlas.Sprite GetResourceIcon(TechType techType)
コード例 #32
0
        public Sprite GetResourceIcon(TechType techType)
#endif
        {
            return(SpriteManager.Get(techType));
        }
コード例 #33
0
ファイル: Game.cs プロジェクト: Omnigazer/StarcraftBot
 public virtual bool canResearch(Unit unit, TechType type) {
   bool ret = bwapiPINVOKE.Game_canResearch(swigCPtr, Unit.getCPtr(unit), TechType.getCPtr(type));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #34
0
ファイル: PacketSender.cs プロジェクト: evanmalmud/Nitrox
        public void PlaceBasePiece(ConstructableBase constructableBase, Base targetBase, TechType techType, Quaternion quaternion)
        {
            String    guid           = GuidHelper.GetGuid(constructableBase.gameObject);
            String    parentBaseGuid = (targetBase == null) ? null : GuidHelper.GetGuid(targetBase.gameObject);
            Vector3   itemPosition   = constructableBase.gameObject.transform.position;
            Transform camera         = Camera.main.transform;

            PlaceBasePiece(guid, ApiHelper.TechType(techType), itemPosition, quaternion, camera, Optional <String> .OfNullable(parentBaseGuid));
        }
コード例 #35
0
 /// <summary>
 /// Returns true if the given unit can research the given tech type and there is enough resources required to research.
 /// </summary>
 /// <param name="unitWhereToResearch"></param>
 /// <param name="techType"></param>
 /// <returns></returns>
 public static bool CanResearch(Unit unitWhereToResearch, TechType techType) {
     return SWIG.BWAPI.bwapi.Broodwar.canResearch(unitWhereToResearch.BwapiObject, techType.BwapiObject);
 }
コード例 #36
0
        private IEnumerable <Entity> CreateEntityWithChildren(EntitySpawnPoint entitySpawnPoint, UnityEngine.Vector3 scale, TechType techType, int cellLevel, string classId, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            Entity spawnedEntity = new Entity(entitySpawnPoint.Position,
                                              entitySpawnPoint.Rotation,
                                              scale,
                                              techType,
                                              cellLevel,
                                              classId,
                                              true,
                                              deterministicBatchGenerator.NextGuid());


            yield return(spawnedEntity);

            AssignPlaceholderEntitiesIfRequired(spawnedEntity, techType, cellLevel, classId, deterministicBatchGenerator);

            IEntityBootstrapper bootstrapper;

            if (customBootstrappersByTechType.TryGetValue(techType, out bootstrapper))
            {
                bootstrapper.Prepare(spawnedEntity, deterministicBatchGenerator);
            }

            // Children are yielded as well so they can be indexed at the top level (for use by simulation
            // ownership and various other consumers).  The parent should always be yielded before the children
            foreach (Entity childEntity in spawnedEntity.ChildEntities)
            {
                yield return(childEntity);
            }
        }
コード例 #37
0
 public override bool canResearch(Unit unit, TechType type) {
   bool ret = bwapiclientPINVOKE.GameImpl_canResearch(swigCPtr, Unit.getCPtr(unit), TechType.getCPtr(type));
   if (bwapiclientPINVOKE.SWIGPendingException.Pending) throw bwapiclientPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #38
0
        public static bool DestroyItemInLocalContainers(TechType techType)
        {
            var itemsContainers = FindAllItemsContainersInRange();

            return(DestroyItemInContainers(techType, itemsContainers));
        }
コード例 #39
0
ファイル: UnitType.cs プロジェクト: Omnigazer/StarcraftBot
 public TechType cloakingTech() {
   TechType ret = new TechType(bwapiPINVOKE.UnitType_cloakingTech(swigCPtr), true);
   return ret;
 }
コード例 #40
0
 public Exosuite2(string classId, string friendlyName, string description, GameObject prefab = null, TechType techToCopy = TechType.None, TechType unlockedBy = TechType.None) : base(classId, friendlyName, description)
 {
     Prefab     = prefab ?? (techToCopy != TechType.None ? CraftData.GetPrefabForTechType(techToCopy, false) : CraftData.GetPrefabForTechType(TechType.None, false));
     TechToCopy = techToCopy;
     UnlockedBy = unlockedBy;
 }
コード例 #41
0
ファイル: TechType.cs プロジェクト: Omnigazer/StarcraftBot
public bool Equals(TechType obj) 
{
    if (obj == null) return false;
    return (obj.swigCPtr.Handle == this.swigCPtr.Handle);
}
コード例 #42
0
        public TechType requiredTech()
        {
            TechType ret = new TechType(bwapiPINVOKE.UnitType_requiredTech(swigCPtr), true);

            return(ret);
        }
コード例 #43
0
ファイル: Unit.cs プロジェクト: Omnigazer/StarcraftBot
 public virtual TechType getTech() {
   TechType ret = new TechType(bwapiPINVOKE.Unit_getTech(swigCPtr), true);
   return ret;
 }
コード例 #44
0
        public TechType cloakingTech()
        {
            TechType ret = new TechType(bwapiPINVOKE.UnitType_cloakingTech(swigCPtr), true);

            return(ret);
        }
コード例 #45
0
 public override TechType getTech() {
   TechType ret = new TechType(bwapiclientPINVOKE.UnitImpl_getTech(swigCPtr), true);
   return ret;
 }
コード例 #46
0
        public static void DumpEquipment()
        {
            int equipmentCount = 0;

            // Count the hotbar tools
            List <ItemsContainer.ItemGroup> itemGroups  = new List <ItemsContainer.ItemGroup>(Inventory.main.quickSlots.container._items.Values);
            List <InventoryItem>            hotbarTools = new List <InventoryItem>();

            for (int i = 0; i < Inventory.main.quickSlots.binding.Length; i++)
            {
                if (Inventory.main.quickSlots.binding[i] != null)
                {
                    equipmentCount++;
                    hotbarTools.Add(Inventory.main.quickSlots.binding[i]);
                }
            }


            // These are hardcoded in the Inventory class to, so why bother
            string[] inventoryEquipmentSlots = new string[]
            {
                "Head",
                "Body",
                "Gloves",
                "Foots",
                "Chip1",
                "Chip2",
                "Tank"
            };

            List <string> equipment = new List <string>();

            // Count all equipment (O2 tank, rebreather, etc.)
            foreach (string equipmentSlot in inventoryEquipmentSlots)
            {
                InventoryItem equipmentItem;
                Inventory.main.equipment.equipment.TryGetValue(equipmentSlot, out equipmentItem);
                if (equipmentItem == null)
                {
                    continue;
                }
                equipment.Add(equipmentSlot);
                equipmentCount++;
            }

            System.Random random          = new System.Random();
            int           randomEquipment = random.Next(0, equipmentCount);

            if (randomEquipment < hotbarTools.Count)
            {
                // Drop a hotbar tool
                Inventory.main.InternalDropItem(hotbarTools[randomEquipment].item, true);
            }
            else
            {
                // Drop a piece of equipment
                string equipmentSlot = equipment[randomEquipment - hotbarTools.Count];

                InventoryItem equipmentItem;
                Inventory.main.equipment.equipment.TryGetValue(equipmentSlot, out equipmentItem);

                // This is basically the Equipment.RemoveItem function, but a little modified
                Inventory.main.equipment.equipment[equipmentSlot] = null;
                TechType equipmentType = equipmentItem.item.GetTechType();
                Inventory.main.equipment.UpdateCount(equipmentType, false);
                Equipment.SendEquipmentEvent(equipmentItem.item, 1, Inventory.main.equipment.owner, equipmentSlot);
                Inventory.main.equipment.NotifyUnequip(equipmentSlot, equipmentItem);
                equipmentItem.container = null;

                // Put the equipment in the inventory
                Inventory.main._container.UnsafeAdd(equipmentItem);

                // Imediately dump it again
                Inventory.main.InternalDropItem(equipmentItem.item, true);
            }
        }
コード例 #47
0
 public override bool useTech(TechType tech, Unit target) {
   bool ret = bwapiclientPINVOKE.UnitImpl_useTech__SWIG_2(swigCPtr, TechType.getCPtr(tech), Unit.getCPtr(target));
   if (bwapiclientPINVOKE.SWIGPendingException.Pending) throw bwapiclientPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #48
0
 public static String TechType(TechType techType)
 {
     return(Enum.GetName(typeof(TechType), techType));
 }
コード例 #49
0
ファイル: UnitCommand.cs プロジェクト: Omnigazer/StarcraftBot
 public static UnitCommand research(Unit unit, TechType tech) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_research(Unit.getCPtr(unit), TechType.getCPtr(tech)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #50
0
 /// <summary>
 /// Allows you to set the display name of a specific <see cref="TechType"/>.
 /// </summary>
 /// <param name="techType">The <see cref="TechType"/> whose display name that is to be changed.</param>
 /// <param name="text">The new display name for the chosen <see cref="TechType"/>.</param>
 public static void SetTechTypeName(TechType techType, string text)
 {
     Main.SetTechTypeName(techType, text);
 }
コード例 #51
0
ファイル: UnitCommand.cs プロジェクト: Omnigazer/StarcraftBot
 public TechType getTechType() {
   TechType ret = new TechType(bwapiPINVOKE.UnitCommand_getTechType(swigCPtr), true);
   return ret;
 }
コード例 #52
0
ファイル: bwapi.cs プロジェクト: Omnigazer/StarcraftBot
 public static TechType getTechType(string name) {
   TechType ret = new TechType(bwapiPINVOKE.getTechType(name), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }