示例#1
0
 private bool ValidateCollider(Collider other)
 {
     if (Grabber.FocusedItem != other)
     {
         PrefabIdentifier componentInParent = other.GetComponentInParent <PrefabIdentifier>();
         if (componentInParent)
         {
             BuildingHealth component = componentInParent.GetComponent <BuildingHealth>();
             if (component && component.CanBeRepaired && (component.CalcMissingRepairMaterial() > 0 || component.CalcMissingRepairLogs() > 0) && LocalPlayer.Inventory.Logs.HasLogs == component.CalcMissingRepairLogs() > 0)
             {
                 return(!other.isTrigger);
             }
             FoundationHealth component2 = componentInParent.GetComponent <FoundationHealth>();
             if (component2 && component2.CanBeRepaired)
             {
                 bool flag  = component2.CalcMissingRepairMaterial() > 0;
                 bool flag2 = component2.CalcMissingRepairLogs() > 0;
                 if (!LocalPlayer.Inventory.Logs.HasLogs == flag || (LocalPlayer.Inventory.Logs.HasLogs && flag2))
                 {
                     return(!other.isTrigger);
                 }
             }
         }
     }
     return(LocalPlayer.Grabber.IsValid(other));
 }
示例#2
0
        private void OnGrabberEnter()
        {
            PrefabIdentifier componentInParent = Grabber.FocusedItemGO.GetComponentInParent <PrefabIdentifier>();

            if (componentInParent)
            {
                BuildingHealth   component  = componentInParent.GetComponent <BuildingHealth>();
                FoundationHealth component2 = componentInParent.GetComponent <FoundationHealth>();
                if ((component && component.CanBeRepaired && (component.CalcMissingRepairMaterial() > 0 || component.CalcMissingRepairLogs() > 0) && !LocalPlayer.Inventory.Logs.HasLogs) || (component2 && component2.CanBeRepaired && (!LocalPlayer.Inventory.Logs.HasLogs == component2.CalcMissingRepairMaterial() > 0 || (LocalPlayer.Inventory.Logs.HasLogs && component2.CalcMissingRepairLogs() > 0))))
                {
                    this._buildingTarget   = component;
                    this._foundationTarget = component2;
                    return;
                }
            }
            this.GrabExit();
            this._buildingTarget   = null;
            this._foundationTarget = null;
            LocalPlayer.Grabber.EnterMessage();
        }