Пример #1
0
        /// <summary>
        /// Calls this method on all mods
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="upgrades"></param>
        public override void AfterUpgradesRefreshed(FirstPersonMover owner, UpgradeCollection upgrades)
        {
            List <Mod> mods = ModsManager.Instance.GetAllLoadedMods();

            for (int i = 0; i < mods.Count; i++)
            {
                mods[i].AfterUpgradesRefreshed(owner, upgrades);
            }
        }
            public static void FirstPersonMover_RefreshUpgrades_Prefix(FirstPersonMover __instance)
            {
                if (__instance == null || __instance.gameObject == null || !__instance.IsAlive() || __instance.GetCharacterModel() == null)
                {
                    return;
                }

                UpgradeCollection upgrade = __instance.GetComponent <UpgradeCollection>();

                ModsManager.Instance.PassOnMod.OnUpgradesRefreshed(__instance, upgrade);
            }
Пример #3
0
        /// <summary>
        /// Calls this method on all mods
        /// </summary>
        /// <param name="me"></param>
        /// <param name="upgrades"></param>
        public override void OnUpgradesRefreshed(FirstPersonMover me, UpgradeCollection upgrades)
        {
            FirstPersonMover firstPersonMover = me.GetComponent <FirstPersonMover>();

            if (!firstPersonMover.IsAlive() || firstPersonMover.GetCharacterModel() == null)
            {
                return;
            }

            List <Mod> mods = ModsManager.Instance.GetAllLoadedMods();

            for (int i = 0; i < mods.Count; i++)
            {
                mods[i].OnUpgradesRefreshed(me, upgrades);
            }
        }
Пример #4
0
            /// <summary>
            /// Gives the specified upgrade to a FirstPersonMover
            /// </summary>
            /// <param name="Target"></param>
            /// <param name="Upgrade"></param>
            public static void Give(FirstPersonMover Target, UpgradeDescription Upgrade)
            {
                if (Target == null)
                {
                    return;
                }

                if (Target.IsMainPlayer())
                {
                    GameDataManager.Instance.SetUpgradeLevel(Upgrade.UpgradeType, Upgrade.Level);
                    UpgradeDescription upgrade = UpgradeManager.Instance.GetUpgrade(Upgrade.UpgradeType, Upgrade.Level);
                    GlobalEventManager.Instance.Dispatch("UpgradeCompleted", upgrade);
                }
                else
                {
                    UpgradeCollection upgradeCollection = Target.gameObject.GetComponent <UpgradeCollection>();

                    if (upgradeCollection == null)
                    {
                        debug.Log("Failed to give upgrade '" + Upgrade.UpgradeName + "' (Level: " + Upgrade.Level + ") to " + Target.CharacterName + " (UpgradeCollection is null)", Color.red);
                        return;
                    }

                    UpgradeTypeAndLevel upgradeToGive = new UpgradeTypeAndLevel {
                        UpgradeType = Upgrade.UpgradeType, Level = Upgrade.Level
                    };

                    List <UpgradeTypeAndLevel> upgrades = ((PreconfiguredUpgradeCollection)upgradeCollection).Upgrades.ToList();

                    upgrades.Add(upgradeToGive);

                    ((PreconfiguredUpgradeCollection)upgradeCollection).Upgrades = upgrades.ToArray();
                    ((PreconfiguredUpgradeCollection)upgradeCollection).InitializeUpgrades();

                    Target.RefreshUpgrades();
                }

                Target.SetUpgradesNeedsRefreshing();
            }
Пример #5
0
 /// <summary>
 /// Called at the end of <see cref="FirstPersonMover.RefreshUpgrades"/>
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="upgrades">The <see cref="UpgradeCollection"/> on the <see cref="FirstPersonMover"/> object</param>
 public virtual void AfterUpgradesRefreshed(FirstPersonMover owner, UpgradeCollection upgrades)
 {
 }
Пример #6
0
    public UpgradeModel()
    {
        TextAsset txt = Resources.Load("items") as TextAsset;

        data = JsonUtility.FromJson <UpgradeCollection> (txt.text);
    }
 /// <summary>
 /// Called at the end of <see cref="FirstPersonMover"/>.RefreshUpgrades()
 /// </summary>
 /// <param name="owner">The <see cref="GameObject"/> with the corresponding <see cref="FirstPersonMover"/> component</param>
 /// <param name="upgrades">The <see cref="UpgradeCollection"/> on the <see cref="FirstPersonMover"/> object</param>
 public virtual void AfterUpgradesRefreshed(GameObject owner, UpgradeCollection upgrades)
 {
 }
 /// <summary>
 /// Called at the start <see cref="FirstPersonMover"/>.RefreshUpgrades()
 /// </summary>
 /// <param name="me">The <see cref="GameObject"/> with the corresponding <see cref="FirstPersonMover"/> component</param>
 /// <param name="upgrades">The <see cref="UpgradeCollection"/> on the <see cref="FirstPersonMover"/> object</param>
 public virtual void OnUpgradesRefreshed(GameObject me, UpgradeCollection upgrades)
 {
 }