コード例 #1
0
        protected IEnumerator Unequip()
        {
            //turn off the player projection (even if it's not already on)
            player.Projections.WeaponTrajectory.Hide();
            ToolState = PlayerToolState.Unequipping;
            //clear all actions
            mActions.Clear();
            LaunchForce = 0f;

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

            //clear dopplegangers, projectiles, etc
            if (HasProjectile)
            {
                WIStackError stackError = WIStackError.None;
                if (ProjectileStack != null)
                {
                    //push the projectile onto the bottom of its stack
                    //this will prevent rampant AQI switching
                    Stacks.Push.Item(ProjectileStack, ProjectileObject, false, StackPushMode.Auto, ref stackError);
                }
                else
                {
                    //if we don't have the stack any more just add it to the player inventory
                    player.Inventory.AddItems(ProjectileObject, ref stackError);
                }
                ProjectileObject = null;
                ProjectileStack  = null;
            }

            ToolState = PlayerToolState.Unequipped;
            RefreshToolDoppleganger(false);

            if (HasWorldItem)
            {
                //parent the worlditem back under its group just in case
                //this will become unnecessary eventually
                //worlditem.UnlockTransform (tr);
                UnlockWorldItem();
                if (worlditem.Is(WIMode.Equipped))
                {
                    worlditem.SetMode(WIMode.Stacked);
                }
                worlditem = null;
            }

            //if we're unequipping because the AQI is changing
            //then wait here until it's finished
            while (player.Inventory.LockQuickslots)
            {
                yield return(null);
            }

            yield break;
        }
コード例 #2
0
 public void SetStackList(List <WIStack> stackList)
 {
     if (mStackList != null && stackList != mStackList)
     {
         mStackList = null;
     }
     mStackList = stackList;
     for (int i = 0; i < StackList.Count; i++)
     {
         WIStack stack = StackList[i];
         //tell the stacks to report to this object
         //other objects will have to subscribe to the container
         stack.RefreshAction += mRefreshContainerAction;
         stack.Container      = this;
         stack.Mode           = mMode;
     }
 }
コード例 #3
0
ファイル: PlayerWearables.cs プロジェクト: yazici/FRONTIERS
        public bool IsWearing(WearableType typeOfWearable, BodyPartType onBodyPart, BodyOrientation orientation, string articlePrefabName)
        {
            bool             upperBody = true;
            int              index     = Wearables.GetWearableIndex(onBodyPart, orientation, ref upperBody);
            WIStackContainer container = null;

            if (upperBody)
            {
                container = State.UpperBodyContainer;
            }
            else
            {
                container = State.LowerBodyContainer;
            }
            WIStack stack = container.StackList[index];
            IWIBase wearableItem;

            if (stack.HasTopItem)
            {
                wearableItem = stack.TopItem;
                if (Wearable.CanWear(typeOfWearable, onBodyPart, orientation, wearableItem))
                {
                    //has top item and we can wear that item, so yes we are wearing it
                    if (!string.IsNullOrEmpty(articlePrefabName))
                    {
                        if (string.Equals(wearableItem.PrefabName, articlePrefabName))
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        // no need to check for article
                        return(true);
                    }
                }
            }
            return(false);
        }