Exemplo n.º 1
0
    public void OnCrash()
    {
        int stepCount = this.GetStepCount();

        LOD_Base[]      array    = UnityEngine.Object.FindObjectsOfType <LOD_Base>();
        List <LOD_Base> list     = new List <LOD_Base>();
        Vector3         position = base.transform.position;
        float           num      = this.Radius + this.Length;

        num *= num;
        float num2 = this.Radius * this.Radius;

        foreach (LOD_Base lod_Base in array)
        {
            if ((lod_Base.transform.position - position).sqrMagnitude < num)
            {
                list.Add(lod_Base);
            }
        }
        for (int j = 0; j < stepCount; j++)
        {
            float   progress  = (float)j / (float)stepCount;
            Vector3 position2 = this.GetPosition(progress);
            foreach (LOD_Base lod_Base2 in list)
            {
                if ((lod_Base2.transform.position - position2).sqrMagnitude < num2 && (!this.PreferBurning || !lod_Base2.Burn()))
                {
                    UnityEngine.Object.Destroy(lod_Base2);
                }
            }
            NeoGrassCutter.Cut(position2, this.Radius, false);
        }
    }
Exemplo n.º 2
0
    public void CutteyCut()
    {
        int   stepCount = this.GetStepCount();
        float num       = this.Radius + this.Length;

        num *= num;
        for (int i = 0; i < stepCount; i++)
        {
            float   progress = (float)i / (float)stepCount;
            Vector3 position = this.GetPosition(progress);
            NeoGrassCutter.Cut(position, this.Radius, false);
        }
    }
Exemplo n.º 3
0
    private void startGrassClearing()
    {
        int stepCount = this.GetStepCount();

        for (int i = 0; i < stepCount; i++)
        {
            float   progress = (float)i / (float)stepCount;
            Vector3 position = this.GetPosition(progress);
            if (this.ShouldCutGrass)
            {
                NeoGrassCutter.Cut(position, this.Radius, false);
            }
        }
    }
Exemplo n.º 4
0
    public void Start()
    {
        int stepCount = this.GetStepCount();

        LOD_Base[]      array    = UnityEngine.Object.FindObjectsOfType <LOD_Base>();
        List <LOD_Base> list     = new List <LOD_Base>();
        Vector3         position = base.transform.position;
        float           num      = this.Radius + this.Length;

        num *= num;
        float num2 = this.Radius * this.Radius;

        LOD_Base[] array2 = array;
        for (int i = 0; i < array2.Length; i++)
        {
            LOD_Base lOD_Base = array2[i];
            if ((lOD_Base.transform.position - position).sqrMagnitude < num)
            {
                list.Add(lOD_Base);
            }
        }
        for (int j = 0; j < stepCount; j++)
        {
            float   progress  = (float)j / (float)stepCount;
            Vector3 position2 = this.GetPosition(progress);
            foreach (LOD_Base current in list)
            {
                if ((current.transform.position - position2).sqrMagnitude < num2)
                {
                    CoopTreeId coopTreeId = null;
                    if (BoltNetwork.isServer)
                    {
                        coopTreeId = current.GetComponent <CoopTreeId>();
                    }
                    UnityEngine.Object.Destroy(current);
                    if (coopTreeId)
                    {
                        coopTreeId.Goto_Removed();
                    }
                }
            }
            if (this.ShouldCutGrass)
            {
                NeoGrassCutter.Cut(position2, this.Radius, false);
            }
        }
    }
Exemplo n.º 5
0
    public void startClearing()
    {
        int stepCount = this.GetStepCount();

        LOD_Base[]      array    = UnityEngine.Object.FindObjectsOfType <LOD_Base>();
        List <LOD_Base> list     = new List <LOD_Base>();
        Vector3         position = base.transform.position;
        float           num      = this.Radius + this.Length;

        num *= num;
        float num2 = this.Radius * this.Radius;

        foreach (LOD_Base lod_Base in array)
        {
            if (!(lod_Base is LOD_Rocks) && (lod_Base.transform.position - position).sqrMagnitude < num)
            {
                list.Add(lod_Base);
            }
        }
        for (int j = 0; j < stepCount; j++)
        {
            float   progress  = (float)j / (float)stepCount;
            Vector3 position2 = this.GetPosition(progress);
            foreach (LOD_Base lod_Base2 in list)
            {
                if ((lod_Base2.transform.position - position2).sqrMagnitude < num2)
                {
                    CoopTreeId coopTreeId = null;
                    if (BoltNetwork.isServer)
                    {
                        coopTreeId = lod_Base2.GetComponent <CoopTreeId>();
                    }
                    Debug.Log(lod_Base2 + " CLEARED");
                    UnityEngine.Object.DestroyImmediate(lod_Base2);
                    if (coopTreeId)
                    {
                        coopTreeId.Goto_Removed();
                    }
                }
            }
            if (this.ShouldCutGrass)
            {
                NeoGrassCutter.Cut(position2, this.Radius, false);
            }
        }
    }
Exemplo n.º 6
0
        protected override void CreateStructure(bool isRepair = false)
        {
            if (isRepair)
            {
                base.Clear();
                base.StartCoroutine(base.DelayedAwake(true));
            }
            Vector3 size = this._logRenderer.bounds.size;

            this._logLength = size.x;
            this._logWidth  = size.z;
            int num = LayerMask.NameToLayer("Prop");

            this._wallRoot        = this.SpawnEdge();
            this._wallRoot.parent = base.transform;
            if (this._wasBuilt)
            {
                int num2 = Mathf.RoundToInt(Vector3.Distance(this._p1, this._p2) / (float)this._width);
                for (int i = 0; i < num2; i++)
                {
                    NeoGrassCutter.Cut(Vector3.Lerp(this._p1, this._p2, (float)i / (float)num2), (float)this._width + 0.5f, false);
                }
            }
        }