Exemple #1
0
 public override void OnEvent(TakeBody evnt)
 {
     if (evnt.Sled && evnt.Body)
     {
         MultiHolder[] componentsInChildren = evnt.Sled.GetComponentsInChildren <MultiHolder>(true);
         if (componentsInChildren.Length > 0)
         {
             componentsInChildren[0].TakeBodyMP(evnt.Body, evnt.RaisedBy);
         }
     }
 }
Exemple #2
0
        private void BodyContentUpdate_MP(ref MultiHolder.ContentTypes showAddIcon)
        {
            bool takeIcon = false;

            if ((base.state.Body0 || base.state.Body1 || base.state.Body2) && !LocalPlayer.Inventory.Logs.HasLogs)
            {
                takeIcon = true;
                if (TheForest.Utils.Input.GetButtonDown("Take"))
                {
                    TakeBody takeBody = TakeBody.Create(GlobalTargets.OnlyServer);
                    takeBody.Sled = base.entity;
                    if (base.state.Body2)
                    {
                        takeBody.Body = base.state.Body2;
                    }
                    else if (base.state.Body1)
                    {
                        takeBody.Body = base.state.Body1;
                    }
                    else if (base.state.Body0)
                    {
                        takeBody.Body = base.state.Body0;
                    }
                    takeBody.Send();
                    Debug.Log("TakeBody:Send");
                }
            }
            if (LocalPlayer.AnimControl.placedBodyGo && LocalPlayer.AnimControl.placedBodyGo.GetComponentInChildren <BoltEntity>() && (!base.state.Body0 || !base.state.Body1 || !base.state.Body2))
            {
                showAddIcon = MultiHolder.ContentTypes.Body;
                if (TheForest.Utils.Input.GetButtonDown("Craft"))
                {
                    GameObject placedBodyGo = LocalPlayer.AnimControl.placedBodyGo;
                    AddBody    addBody      = AddBody.Create(GlobalTargets.OnlyServer);
                    addBody.Body = placedBodyGo.GetComponentInChildren <BoltEntity>();
                    addBody.Sled = base.entity;
                    addBody.Send();
                    LocalPlayer.AnimControl.heldBodyGo.SetActive(false);
                    LocalPlayer.Animator.SetBoolReflected("bodyHeld", false);
                    LocalPlayer.AnimControl.carry        = false;
                    LocalPlayer.AnimControl.placedBodyGo = null;
                    LocalPlayer.Inventory.ShowAllEquiped(true);
                    Scene.HudGui.DropButton.SetActive(false);
                    placedBodyGo.SetActive(true);
                    placedBodyGo.SendMessage("dropFromCarry", false, SendMessageOptions.DontRequireReceiver);
                }
            }
            Scene.HudGui.HolderWidgets[6].Show(takeIcon, this._contentTypeActual == MultiHolder.ContentTypes.Body && showAddIcon == MultiHolder.ContentTypes.Body, this.TakeIcon.transform);
        }
 public override void OnEvent(TakeBody evnt)
 {
     if (evnt.Sled && evnt.Body)
     {
         MultiHolder[] componentsInChildren = evnt.Sled.GetComponentsInChildren<MultiHolder>(true);
         if (componentsInChildren.Length > 0)
         {
             componentsInChildren[0].TakeBodyMP(evnt.Body, evnt.RaisedBy);
         }
     }
 }