public void Init(float angle, ObjectSide side) { Debug.Log("angle: " + angle); m_AttackAngle = angle; m_TimeActive = VISIBLE_TIME; m_Side = side; Vector3 rotation = transform.eulerAngles; rotation.z = angle * Mathf.Rad2Deg; // because the sprite is up rotation.z -= 90; transform.eulerAngles = rotation; m_speed = SPEED; }
public int getObjectSide(ObjectSide side) { switch (side) { case ObjectSide.TOP: return Position_Y; //The pos_y is on the top left side of the sprite, so the top can give pos_y back case ObjectSide.BOTTOM: return Position_Y + Height; //The bottom is basicly the origin point plus the height of the object case ObjectSide.LEFT: return Position_X; //Same as the top, the pos_x gives the left side of the object case ObjectSide.RIGHT: return Position_X + Width; //And lastly the right side is the pos_x with the width of the object default: return Position_Y; //Returns the default top side, which is a Y value } }