Esempio n. 1
0
 public override void OnEvent(CancelBluePrint evnt)
 {
     if (evnt.BluePrint)
     {
         Craft_Structure componentInChildren = evnt.BluePrint.GetComponentInChildren <Craft_Structure>();
         if (componentInChildren)
         {
             componentInChildren.CancelBlueprintSafe();
         }
     }
 }
Esempio n. 2
0
        protected virtual IEnumerator OnTreeCutDown(GameObject trunk)
        {
            Transform fallingT;

            if (trunk.GetComponent <Rigidbody>())
            {
                fallingT = trunk.transform;
            }
            else
            {
                fallingT = trunk.GetComponentInChildren <Rigidbody>().transform;
            }
            base.transform.parent = fallingT;
            foreach (Collider collider in base.GetComponentsInChildren <Collider>())
            {
                collider.enabled = false;
            }
            if (!BoltNetwork.isClient)
            {
                yield return(YieldPresets.WaitPointHeightSeconds);
            }
            else
            {
                yield return(YieldPresets.WaitPointSixSeconds);
            }
            foreach (StructureAnchor structureAnchor in base.GetComponentsInChildren <StructureAnchor>())
            {
                UnityEngine.Object.Destroy(structureAnchor.gameObject);
            }
            Craft_Structure ghost = base.GetComponentInChildren <Craft_Structure>();

            if (ghost && ghost.transform.parent == base.transform)
            {
                if (!BoltNetwork.isClient)
                {
                    ghost.CancelBlueprintSafe();
                }
            }
            else
            {
                yield return(YieldPresets.WaitThreeSeconds);

                BuildingHealth bh = base.GetComponent <BuildingHealth>();
                bh.Collapse(base.transform.position + Vector3.down);
            }
            yield break;
        }
Esempio n. 3
0
        protected override IEnumerator OnTreeCutDown(GameObject trunk)
        {
            Transform fallingT;

            if (trunk.GetComponent <Rigidbody>())
            {
                fallingT = trunk.transform;
            }
            else
            {
                fallingT = trunk.GetComponentInChildren <Rigidbody>().transform;
            }
            base.transform.parent = fallingT;
            foreach (Collider collider in base.GetComponentsInChildren <Collider>())
            {
                collider.enabled = false;
            }
            if (!BoltNetwork.isClient)
            {
                yield return(YieldPresets.WaitPointHeightSeconds);
            }
            else
            {
                yield return(YieldPresets.WaitPointSixSeconds);
            }
            Craft_Structure ghost = base.GetComponentInChildren <Craft_Structure>();

            if (ghost && ghost.transform.parent == base.transform)
            {
                if (!BoltNetwork.isClient)
                {
                    ghost.CancelBlueprintSafe();
                }
            }
            else
            {
                yield return(YieldPresets.WaitThreeSeconds);

                CollapseStructure cs = base.gameObject.AddComponent <CollapseStructure>();
                cs._destructionForceMultiplier = 0.1f;
                cs._capsuleDirection           = CapsuleDirections.Z;
            }
            yield break;
        }