コード例 #1
0
    //public void SwapModelDown()
    //{
    //    if (models.Length != 0)
    //    {
    //        currentIndex--;
    //        if (currentIndex < 0)
    //            currentIndex = models.Length - 1;
    //        gameObject.GetComponent<MeshFilter>().sharedMesh = models[currentIndex].sharedMesh;
    //        if (ammo != null)
    //        {
    //            ammo.LastPart();
    //            model.RunStats();
    //        }
    //        else if (grip != null)
    //        {
    //            grip.LastPart();
    //            model.RunStats();
    //        }
    //        else if (barrel != null)
    //        {
    //            barrel.LastPart();
    //            model.RunStats();
    //        }
    //    }
    //}

    public void SwapModelDown()
    {
        if (models.Length != 0)
        {
            currentIndex--;
            if (currentIndex < 0)
            {
                currentIndex = models.Length - 1;
            }
            gameObject.GetComponent <MeshFilter>().sharedMesh = models[currentIndex].sharedMesh;

            if (ammo != null)
            {
                if (InvItem.invAmmos[currentIndex])
                {
                    ammo.LastPart();
                    model.RunStats();
                }
                else
                {
                    ammo.LastPart();
                    SwapModelDown();
                }
            }
            else if (grip != null)
            {
                if (InvItem.invGrips[currentIndex])
                {
                    grip.LastPart();
                    model.RunStats();
                }
                else
                {
                    grip.LastPart();
                    SwapModelDown();
                }
            }
            else if (barrel != null)
            {
                if (InvItem.invBarrels[currentIndex])
                {
                    barrel.LastPart();
                    model.RunStats();
                }
                else
                {
                    barrel.LastPart();
                    SwapModelDown();
                }
            }
        }
    }
コード例 #2
0
 private void LastPartAll()
 {
     myGrip.LastPart();
     myBarrel.LastPart();
     myAmmo.LastPart();
 }