Esempio n. 1
0
 public override void tick()
 {
     if (this.isConstructing && this.isConstructable)
     {
         this.isConstructing = false;
         if (!Dedicator.isDedicated)
         {
             base.player.playSound(((ItemStructureAsset)base.player.equipment.asset).use);
         }
         if (Provider.isServer)
         {
             AlertTool.alert(base.transform.position, 8f);
         }
     }
     if (base.channel.isOwner)
     {
         if (this.help == null)
         {
             return;
         }
         if (this.isUsing)
         {
             return;
         }
         if (this.check())
         {
             if (!this.isValid)
             {
                 this.isValid = true;
                 HighlighterTool.help(this.help, this.isValid);
             }
         }
         else if (this.isValid)
         {
             this.isValid = false;
             HighlighterTool.help(this.help, this.isValid);
         }
         this.offset        = Mathf.Lerp(this.offset, (float)(this.rotate * 90), 8f * Time.deltaTime);
         this.help.position = this.point;
         this.help.rotation = Quaternion.Euler(-90f, this.angle + this.offset, 0f);
     }
 }
Esempio n. 2
0
 public static void help(Transform target, bool isValid)
 {
     HighlighterTool.help(target, isValid, false);
 }
Esempio n. 3
0
 public override void equip()
 {
     base.player.animator.play("Equip", true);
     this.useTime = base.player.animator.getAnimationLength("Use");
     if (Dedicator.isDedicated)
     {
         GameObject gameObject = Object.Instantiate <GameObject>(((ItemStructureAsset)base.player.equipment.asset).clip, Vector3.zero, Quaternion.identity);
         gameObject.name = "Helper";
         Collider component = gameObject.GetComponent <Collider>();
         if (component != null)
         {
             this.boundsUse     = true;
             this.boundsCenter  = gameObject.transform.InverseTransformPoint(component.bounds.center);
             this.boundsExtents = component.bounds.extents;
         }
         Object.Destroy(gameObject);
         this.boundsOverlap = this.boundsExtents + new Vector3(0.1f, 0.1f, 0.1f);
     }
     if (base.channel.isOwner)
     {
         this.help          = StructureTool.getStructure(base.player.equipment.itemID, 0);
         this.help.position = Vector3.zero;
         this.help.rotation = Quaternion.identity;
         Collider component2 = this.help.GetComponent <Collider>();
         if (component2 != null)
         {
             this.boundsUse     = true;
             this.boundsCenter  = this.help.InverseTransformPoint(component2.bounds.center);
             this.boundsExtents = component2.bounds.extents;
             Object.Destroy(component2);
         }
         this.boundsOverlap = this.boundsExtents + new Vector3(0.1f, 0.1f, 0.1f);
         this.help.rotation = Quaternion.Euler(-90f, 0f, 0f);
         HighlighterTool.help(this.help, this.isValid);
         if (this.help.FindChild("Clip") != null)
         {
             Object.Destroy(this.help.FindChild("Clip").gameObject);
         }
         if (this.help.FindChild("Nav") != null)
         {
             Object.Destroy(this.help.FindChild("Nav").gameObject);
         }
         if (this.help.FindChild("Cutter") != null)
         {
             Object.Destroy(this.help.FindChild("Cutter").gameObject);
         }
         if (this.help.FindChild("Roof") != null)
         {
             Object.Destroy(this.help.FindChild("Roof").gameObject);
         }
         if (this.help.FindChild("Block") != null)
         {
             Object.Destroy(this.help.FindChild("Block").gameObject);
         }
         for (int i = 0; i < 4; i++)
         {
             if (!(this.help.FindChild("Wall") != null))
             {
                 break;
             }
             Object.Destroy(this.help.FindChild("Wall").gameObject);
         }
         for (int j = 0; j < 4; j++)
         {
             if (!(this.help.FindChild("Pillar") != null))
             {
                 break;
             }
             Object.Destroy(this.help.FindChild("Pillar").gameObject);
         }
     }
 }