コード例 #1
0
    private void Update()
    {
        bool flag = this.Player.HasInSlot(Item.EquipmentSlot.RightHand, this._rabbitAliveItemId);

        if (this.RabbitsReal > 0 && !flag)
        {
            this.TakeIcon.SetActive(true);
            if (TheForest.Utils.Input.GetButtonDown("Take"))
            {
                LocalPlayer.Sfx.PlayWhoosh();
                this.Player.AddItem(this._rabbitAliveItemId, 1, false, false, (WeaponStatUpgrade.Types)(-2));
                if (BoltNetwork.isRunning)
                {
                    RabbitTake rabbitTake = RabbitTake.Create(GlobalTargets.OnlyServer);
                    rabbitTake.Cage = this.entity;
                    rabbitTake.Send();
                }
                else
                {
                    this.RabbitRender[this.RabbitsReal - 1].SetActive(false);
                    this.RabbitsReal--;
                }
            }
        }
        else
        {
            this.TakeIcon.SetActive(false);
        }
        if (this.RabbitsReal < 7 && flag)
        {
            this.AddIcon.SetActive(true);
            if (TheForest.Utils.Input.GetButtonDown("Craft"))
            {
                this.Player.UnequipItemAtSlot(Item.EquipmentSlot.RightHand, false, false, true);
                if (BoltNetwork.isRunning)
                {
                    RabbitAdd rabbitAdd = RabbitAdd.Create(GlobalTargets.OnlyServer);
                    rabbitAdd.Cage = this.entity;
                    rabbitAdd.Send();
                }
                else
                {
                    this.RabbitsReal++;
                    this.RabbitRender[this.RabbitsReal - 1].SetActive(true);
                }
            }
        }
        else
        {
            this.AddIcon.SetActive(false);
        }
    }
コード例 #2
0
 private void TakeRabbit()
 {
     LocalPlayer.Inventory.AddItem(this._rabbitAliveItemId, 1, false, false, null);
     if (BoltNetwork.isRunning)
     {
         RabbitTake rabbitTake = RabbitTake.Create(GlobalTargets.OnlyServer);
         rabbitTake.Cage = base.entity;
         rabbitTake.Send();
     }
     else
     {
         this.RabbitRender[this.RabbitsReal - 1].SetActive(false);
         this.RabbitsReal--;
     }
 }