示例#1
0
    //public void SwapModelUp()
    //{
    //    if (models.Length != 0)
    //    {
    //        currentIndex++;
    //        if (currentIndex >= models.Length)
    //            currentIndex = 0;
    //        gameObject.GetComponent<MeshFilter>().sharedMesh = models[currentIndex].sharedMesh;
    //        if (ammo != null)
    //        {
    //            ammo.NextPart();
    //            model.RunStats();
    //        }
    //        else if (grip != null)
    //        {
    //            grip.NextPart();
    //            model.RunStats();
    //        }
    //        else if (barrel != null)
    //        {
    //            barrel.NextPart();
    //            model.RunStats();
    //        }
    //    }
    //}

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


            if (ammo != null)
            {
                if (InvItem.invAmmos[currentIndex])
                {
                    ammo.NextPart();
                    model.RunStats();
                }
                else
                {
                    ammo.NextPart();
                    SwapModelUp();
                }
            }
            else if (grip != null)
            {
                if (InvItem.invGrips[currentIndex])
                {
                    grip.NextPart();
                    model.RunStats();
                }
                else
                {
                    grip.NextPart();
                    SwapModelUp();
                }
            }
            else if (barrel != null)
            {
                if (InvItem.invBarrels[currentIndex])
                {
                    barrel.NextPart();
                    model.RunStats();
                }
                else
                {
                    barrel.NextPart();
                    SwapModelUp();
                }
            }
        }
    }
示例#2
0
 private void NextPartAll()
 {
     myGrip.NextPart();
     myBarrel.NextPart();
     myAmmo.NextPart();
 }