Example #1
0
 private void Update()
 {
     if (this.entity.IsAttached() && this.entity.isOwner && this.largeNoose)
     {
         ITrapLargeState state = this.entity.GetState <ITrapLargeState>();
         state.CanCutDown = this.cutTrigger.activeInHierarchy;
         state.CanReset   = this.resetTrigger.activeInHierarchy;
     }
 }
Example #2
0
    private void OnCanResetChanged()
    {
        ITrapLargeState state = this.entity.GetState <ITrapLargeState>();

        if (state.CanReset)
        {
            this.resetTrigger.SetActive(true);
        }
        else
        {
            this.resetTrigger.SetActive(false);
        }
    }
Example #3
0
    private void OnCanCutDownChanged()
    {
        ITrapLargeState state = this.entity.GetState <ITrapLargeState>();

        if (state.CanCutDown)
        {
            this.cutTrigger.SetActive(true);
        }
        else
        {
            this.cutTrigger.SetActive(false);
        }
    }
Example #4
0
 public override void Attached()
 {
     if (this.entity.isOwner)
     {
         if (this.entity.StateIs <ITrapLargeState>())
         {
             this.entity.GetState <ITrapLargeState>().Sprung = this.sprung;
         }
         if (this.entity.StateIs <ITrapRabbitState>())
         {
             this.entity.GetState <ITrapRabbitState>().Sprung = this.sprung;
         }
     }
     else
     {
         if (this.entity.StateIs <ITrapLargeState>())
         {
             ITrapLargeState state = this.entity.GetState <ITrapLargeState>();
             if (state.Sprung)
             {
                 this.OnSprungMP();
             }
             state.AddCallback("Sprung", new PropertyCallbackSimple(this.OnSprungMP));
             if (this.largeNoose)
             {
                 state.AddCallback("CanCutDown", new PropertyCallbackSimple(this.OnCanCutDownChanged));
                 state.AddCallback("CanReset", new PropertyCallbackSimple(this.OnCanResetChanged));
             }
         }
         if (this.entity.StateIs <ITrapRabbitState>())
         {
             if (this.entity.GetState <ITrapRabbitState>().Sprung)
             {
                 this.OnSprungMP();
             }
             this.entity.GetState <ITrapRabbitState>().AddCallback("Sprung", new PropertyCallbackSimple(this.OnSprungMP));
         }
     }
 }