Ejemplo n.º 1
0
 //check the position of each cube/lines at the begining to turn on itself with an other function dirOffset()
 private void originPosition()
 {
     if (transform.position.x == 20)
     {
         posOrigin = OriginPos.Right;
     }
     else if (transform.position.x == -20)
     {
         posOrigin = OriginPos.Left;
     }
     else if (transform.position.y == 20)
     {
         posOrigin = OriginPos.Up;
     }
     else if (transform.position.y == -20)
     {
         posOrigin = OriginPos.Down;
     }
 }
Ejemplo n.º 2
0
 private void SetOrigin(OriginPos origin)
 {
     switch (origin)
     {
         case OriginPos.TOP_LEFT:
             m_vecOrigin = new Vector2(0, 0);
             break;
         case OriginPos.TOP_RIGHT:
             m_vecOrigin = new Vector2(m_texBase.Width, 0);
             break;
         case OriginPos.BOTTOM_LEFT:
             m_vecOrigin = new Vector2(0, m_texBase.Height);
             break;
         case OriginPos.BOTTOM_RIGHT:
             m_vecOrigin = new Vector2(m_texBase.Width, m_texBase.Height);
             break;
         case OriginPos.CENTER:
             m_vecOrigin = new Vector2((m_texBase.Width / 2), (m_texBase.Height / 2));
             break;
         default:
             m_vecOrigin = new Vector2(0, 0); // TOP_LEFT by default
             break;
     }
 }
Ejemplo n.º 3
0
        public void LoadContent(ContentManager contentManager, string texLocation, OriginPos origin)
        {
            m_texBase = contentManager.Load<Texture2D>(texLocation);
            SetOrigin(origin);

            m_iMaxFrames = m_texBase.Width / m_iFrameWidth;

            // Construct initial frame Rect
            m_frameRect = new Rectangle(0, 0, m_iFrameWidth, m_texBase.Height);

            CalculateBoundingBoxes();
        }