internal static void LoadModContent(Mod mod) { foreach (var soul in mod.GetAllSouls()) { SoulManager.AddSoul((BaseSoul)Activator.CreateInstance(soul)); } }
public void Initialize(SoulManager parameterManager) { this.manager = parameterManager; this.movementAgentDriver = this.gameObject.GetComponent <NavMeshAgentDriver>(); if (this.movementAgentDriver != null) { this.movementAgentDriver.OnStopped += () => { if (this.movementAgentDriver != null) { this.movementAgentDriver.MoveTo(this.movementAgentDriver.GetRandomPointOnNavMesh()); } else { Debug.LogError("Null movement agent driver reference"); } }; } else { Debug.LogError("Null agent driver reference"); } }
/// <summary> /// Triggers on pickup. Checks if a corresponding soul exists and sets that soul as acquired. /// </summary> /// <param name="player">The player that interacts with this item.</param> /// <returns>Always returns false. This item is not actually added to the players' inventory.</returns> public override bool OnPickup(Player player) { SoulPlayer sp = player.GetModPlayer <SoulPlayer>(); if (MysticHunter.Instance.SoulDict.TryGetValue(soulNPC, out BaseSoul soul)) { Color c = Color.Red; if (soul.soulType == SoulType.Blue) { c = Color.Blue; } else if (soul.soulType == SoulType.Yellow) { c = Color.Yellow; } if (!sp.UnlockedSouls.ContainsKey(soulNPC)) { sp.UnlockedSouls.Add(soulNPC, 0); } if (!sp.HasMaxSouls(soulNPC)) { // Display a message in chat. Main.NewText($"You collected your {numberList[sp.UnlockedSouls[soulNPC]]} {soul.SoulNPCName()} soul.", c); // Increase the stack for this soul. sp.UnlockedSouls[soulNPC]++; // Update the local player soul data and UI. sp.UpdateActiveSoulData(); SoulManager.ReloadSoulIndexUI(); // Emit a sound a particle effect. Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoulPickup"), player.Center); for (int i = 0; i < 5; ++i) { Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.height, DustID.AncientLight, 0f, 0f, 255, c, Main.rand.Next(20, 26) * 0.1f)]; d.noLight = true; d.noGravity = true; d.velocity *= 0.5f; } } } else { // Debug message for when a soul with the given `soulDataID` cannot be found. Main.NewText("Soul with ID '" + soulNPC + "' cannot be found."); } return(false); }
void Start() { //JMUPING AND MOVING\\ doubleJump = doubleJumpValue; heroRigidbody = GetComponent <Rigidbody2D>(); //SPRITE ANIMATOR\\ heroAnimator = GetComponent <Animator>(); //SETTING THE HEALTH AT START OF GAME\\ currentHealth = maxHealth; //SOULS\\ sm = GameObject.FindGameObjectWithTag("SoulManager").GetComponent <SoulManager>(); }
void Awake() { gameIsOver = false; if (instance != null) { Destroy(this); } else { instance = this; } inputWatcher = FindObjectOfType <InputWatcher>(); soulManager = FindObjectOfType <SoulManager>(); audioController = FindObjectOfType <AudioController>(); }
public void OnSoulRatioChanged(SoulManager sender) { if (sender != null) { if (this.slider != null) { this.slider.value = sender.CurrentBrokenSoulsAmount / (float)(sender.CurrentNormalSoulsAmount + sender.CurrentBrokenSoulsAmount); } else { Debug.LogError("Null slider reference"); } } else { Debug.LogError("Null sender reference"); } }
public Dragon(DragonInfo runtime, DragonManager manager, SoulManager soulManager) { Utils.Assert(runtime == null || manager == null || soulManager == null, "Can't initialize Dragon Object for input data is null."); RTData = runtime; Config = manager.getDragonConfig(RTData.lv); if (RTData.num == AoYiData.DRAGON_EARTH) { Fragment = soulManager.GetFramentByType(ItemType.Earth_Frage); } else { Fragment = soulManager.GetFramentByType(ItemType.Nameike_Frage); } Fragment.Sort(new SortByDraonBallNum()); Utils.Assert(Config == null, "Dragon Up Level Config file is wrong. lv = " + RTData.lv); }
private void SoulSlotLeftClick(UIMouseEvent evt, UIElement e) { if (parent.soulListPanel != null) { if (!(e is SoulIndexUISoulSlot slot)) { return; } // If the new filter is the same as the filter that's already there, just ignore. if (parent.soulListPanel.soulList.filter == slot.soulType) { return; } // Set the correct filter. parent.soulListPanel.soulList.filter = slot.soulType; SoulManager.ReloadSoulIndexUI(); } }
public override void Load(TagCompound tag) { try { var keys = tag.Get <List <short> >("acquiredSoulsKeys"); var values = tag.Get <List <byte> >("acquiredSoulsValues"); UnlockedSouls = keys.Zip(values, (k, v) => new { Key = k, Value = v }).ToDictionary(x => x.Key, x => x.Value); activeSouls = new NetSoulData[3, 3]; for (int i = 0; i < activeSouls.GetLength(0); i++) { for (int j = 0; j < activeSouls.GetLength(1); j++) { short soulNPC = tag.GetShort("soul" + i + ":" + j); activeSouls[i, j] = new NetSoulData(); if (SoulManager.GetSoul(soulNPC) != null) { if (UnlockedSouls.TryGetValue(soulNPC, out byte result)) { activeSouls[i, j].stack = result; activeSouls[i, j].soulNPC = soulNPC; } } } } activeSoulConfig = tag.Get <int>(nameof(activeSoulConfig)); } catch { UnlockedSouls = new Dictionary <short, byte>(); activeSouls = new NetSoulData[3, 3] { { new NetSoulData(), new NetSoulData(), new NetSoulData() }, { new NetSoulData(), new NetSoulData(), new NetSoulData() }, { new NetSoulData(), new NetSoulData(), new NetSoulData() }, }; } }
public override void OnEnterWorld(Player player) => SoulManager.ReloadSoulIndexUI();