Esempio n. 1
0
        protected IEnumerator Equip()
        {
            if (Holstered)
            {
                Debug.Log("Holstered");
                yield break;
            }

            ToolState = PlayerToolState.Equipping;
            //set equipped mode
            worlditem.SetMode(WIMode.Equipped);
            //clear all actions
            mActions.Clear();
            //see if the worlditem is a weapon
            //if it is, find a projectile for it
            Weapon     weapon     = null;
            Equippable equippable = null;

            if (worlditem.Is <Equippable> (out equippable))              //tell equippable that we're equipping
            {
                equippable.EquipStart();
            }

            //refresh our dopplegangers
            //we do this BEFORE playing the generic equip animation
            //so it actually has something to show
            RefreshToolDoppleganger(true);
            if (equippable != null)
            {
                equippable.EquipFinish();
            }

            yield return(StartCoroutine(PlayAnimation("ToolGenericEquip")));

            ToolState = PlayerToolState.Equipped;
            yield break;
        }