Building_LaserFence class.
상속: Building
예제 #1
0
        private void ActivateFence(Rot4 direction, int fenceLength)
        {
            this.fenceLength[direction.AsInt] = fenceLength;

            if ((direction == Rot4.North) ||
                (direction == Rot4.East))
            {
                // Spawn laser fences.
                for (int offset = 1; offset <= this.fenceLength[direction.AsInt]; offset++)
                {
                    IntVec3             fencePosition = this.Position + new IntVec3(0, 0, offset).RotatedBy(direction);
                    Building_LaserFence laserFence    = ThingMaker.MakeThing(ThingDef.Named("LaserFence")) as Building_LaserFence;
                    laserFence.pylon = this;
                    GenSpawn.Spawn(laserFence, fencePosition, this.Map);
                }
                // Drawing parameters.
                Vector3 fenceScale = new Vector3(fenceLength, 1f, 1f);
                if (direction == Rot4.North)
                {
                    northFenceScale = fenceScale;
                    northFenceMatrix.SetTRS(base.DrawPos + new Vector3(0f, 0f, 0.5f + (float)fenceLength / 2f) + Altitudes.AltIncVect, Quaternion.AngleAxis(90f, Vector3.up), northFenceScale);
                }
                else if (direction == Rot4.East)
                {
                    eastFenceScale = fenceScale;
                    eastFenceMatrix.SetTRS(base.DrawPos + new Vector3(0.5f + (float)fenceLength / 2f, 0f, 0f) + Altitudes.AltIncVect, Quaternion.identity, eastFenceScale);
                }
            }
        }
예제 #2
0
 public void ActivateFence(Rot4 direction, int fenceLength)
 {
     this.fenceLength[direction.AsInt] = fenceLength;
     if ((direction == Rot4.North) ||
         (direction == Rot4.East))
     {
         // Spawn laser fences.
         for (int offset = 1; offset <= this.fenceLength[direction.AsInt]; offset++)
         {
             IntVec3             fencePosition = this.Position + new IntVec3(0, 0, offset).RotatedBy(direction);
             Building_LaserFence laserFence    = ThingMaker.MakeThing(Util_LaserFence.LaserFenceDef) as Building_LaserFence;
             laserFence.pylon = this;
             GenSpawn.Spawn(laserFence, fencePosition, this.Map, direction);
         }
     }
 }