protected override void Start() { base.Start(); modSocketDictionary = new Dictionary <ModSpot, ModSocket>() { { ModSpot.ArmR, new ModSocket(rightArmSocket) }, { ModSpot.ArmL, new ModSocket(leftArmSocket) }, }; allModSpots = new List <ModSpot>() { ModSpot.ArmL, ModSpot.ArmR }; modToSwap = ModSpot.Default; AnalyticsManager.Instance.SetModManager(this); modInventory = GetComponent <ModInventory>(); Debug.Assert(modInventory); if (assignFromPool) { AttachRandomMods(); } else { AttachMods(leftArmOnLoad, rightArmOnLoad); } isDead = false; isLevelComplete = false; }
public Mod GetMod(ModType modType, ModSpot modSpot) { if (modInventory.ContainsKey(modType)) { return(modInventory[modType].GetMod(modSpot)); } return(null); }
public Mod GetMod(ModSpot modSpot) { if (!modContainers[modSpot].isEquipped && modContainers[modSpot].modObject) { modContainers[modSpot].modObject.SetActive(true); return(modContainers[modSpot].mod); } return(null); }
private void Detach(ModSpot spot, bool isSwapping = false) { if (modSocketDictionary[spot].mod != null) { modSocketDictionary[spot].mod.transform.SetParent(modInventory.GetModParent(modSocketDictionary[spot].mod.getModType())); modSocketDictionary[spot].mod.gameObject.SetActive(false); modSocketDictionary[spot].mod.DetachAffect(); modSocketDictionary[spot].mod = null; } }
public void EquipMod(ModSpot spot, ModType type) { canActivate = false; Mod modToEquip = modInventory.GetMod(type, spot); if (modToEquip != null) { Attach(spot, modToEquip); } }
private void Attach(ModSpot spot, Mod mod, bool isSwapping = false) { mod.gameObject.SetActive(true); if (modSocketDictionary[spot].mod != null && !isSwapping) { Detach(spot); } mod.setModSpot(spot); mod.transform.SetParent(modSocketDictionary[spot].socket); Vector3 localPos = modPositions[mod.getModType()].localPos; localPos.x *= Mathf.Sign(modSocketDictionary[spot].socket.localPosition.x); mod.transform.localPosition = localPos; mod.transform.localRotation = Quaternion.identity; mod.transform.localScale = Vector3.one; modSocketDictionary[spot].mod = mod; mod.AttachAffect(ref playerStats, velBody); }
public void HideMod(ModSpot modSpot) { modContainers[modSpot].modObject.SetActive(true); }
public void setModSpot(ModSpot modSpot) { spot = modSpot; }