Exemplo n.º 1
0
 public override void OnEvent(RabbitAdd evnt)
 {
     if (evnt.Cage)
     {
         evnt.Cage.GetState <IRabbitCage>().RabbitCount++;
     }
 }
Exemplo n.º 2
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);
        }
    }
Exemplo n.º 3
0
 private void AddRabbit()
 {
     if (BoltNetwork.isRunning)
     {
         RabbitAdd rabbitAdd = RabbitAdd.Create(GlobalTargets.OnlyServer);
         rabbitAdd.Cage = base.entity;
         rabbitAdd.Send();
     }
     else
     {
         this.RabbitsReal++;
         this.RabbitRender[this.RabbitsReal - 1].SetActive(true);
     }
 }
Exemplo n.º 4
0
 public override void OnEvent(RabbitAdd evnt)
 {
     if (evnt.Cage)
     {
         evnt.Cage.GetState<IRabbitCage>().RabbitCount++;
     }
 }