コード例 #1
0
    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;
    }
コード例 #2
0
 public Mod GetMod(ModType modType, ModSpot modSpot)
 {
     if (modInventory.ContainsKey(modType))
     {
         return(modInventory[modType].GetMod(modSpot));
     }
     return(null);
 }
コード例 #3
0
 public Mod GetMod(ModSpot modSpot)
 {
     if (!modContainers[modSpot].isEquipped && modContainers[modSpot].modObject)
     {
         modContainers[modSpot].modObject.SetActive(true);
         return(modContainers[modSpot].mod);
     }
     return(null);
 }
コード例 #4
0
 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;
     }
 }
コード例 #5
0
    public void EquipMod(ModSpot spot, ModType type)
    {
        canActivate = false;
        Mod modToEquip = modInventory.GetMod(type, spot);

        if (modToEquip != null)
        {
            Attach(spot, modToEquip);
        }
    }
コード例 #6
0
    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);
    }
コード例 #7
0
 public void HideMod(ModSpot modSpot)
 {
     modContainers[modSpot].modObject.SetActive(true);
 }
コード例 #8
0
 public void setModSpot(ModSpot modSpot)
 {
     spot = modSpot;
 }