Ejemplo n.º 1
0
 /// <summary>
 /// Rotates the object
 /// </summary>
 public virtual void Rotate(bool isClockWise)
 {
     this.Size = this.Size.Rotate(isClockWise);
     this.transform.localEulerAngles += new Vector3(0, 0, isClockWise ? -90 : 90);
     if (isClockWise)
     {
         this.Rotation++;
     }
     else
     {
         this.Rotation--;
     }
     this.OnMove();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs a list of needed coordinates
        /// </summary>
        /// <param name="targetEntity">Target entity</param>
        /// <param name="index">Index coordinate</param>
        /// <returns>A list of coordinates that the target entity will take up</returns>
        private List <GridCoordinate> _getNeededCoordinates(GridCoordinate index, GridEntitySize entitySize)
        {
            List <GridCoordinate> result = new List <GridCoordinate>();

            int signX = entitySize.ExtrudeX > 0 ? 1 : -1;
            int signY = entitySize.ExtrudeY > 0 ? 1 : -1;

            for (int x = 0; x <= Math.Abs(entitySize.ExtrudeX); x++)
            {
                for (int y = 0; y <= Math.Abs(entitySize.ExtrudeY); y++)
                {
                    result.Add(index + new GridCoordinate(x * signX, y * signY));
                }
            }
            return(result);
        }