示例#1
0
        public Position GetPosition(int x, int y)
        {
            if (MiddleSquare.Contains(x, y))
            {
                return(Position.Middle);
            }
            else if (Q1.Contains(x, y))
            {
                return(Position.Q1);
            }
            else if (Q2.Contains(x, y))
            {
                return(Position.Q2);
            }
            else if (Q3.Contains(x, y))
            {
                return(Position.Q3);
            }
            else if (Q4.Contains(x, y))
            {
                return(Position.Q4);
            }

            return(Position.None);
        }
示例#2
0
    // Use this for initialization
    void Start()
    {
        sub = new Subject();
        TopSquare    tSq0 = new TopSquare(squareObj0);
        TopSquare    tSq1 = new TopSquare(squareObj1);
        MiddleSquare mSq0 = new MiddleSquare(squareObj2);
        MiddleSquare mSq1 = new MiddleSquare(squareObj3);
        BottomSquare bSq0 = new BottomSquare(squareObj4);
        BottomSquare bSq1 = new BottomSquare(squareObj5);

        sub.AddObservers(tSq0);
        sub.AddObservers(tSq1);
        sub.AddObservers(mSq0);
        sub.AddObservers(mSq1);
        sub.AddObservers(bSq0);
        sub.AddObservers(bSq1);
    }