示例#1
0
    public void InstantiateIllegalMoveWarnings()
    {
        foreach (IllegalMove illegalMove in IllegalMoves)
        {
            RenjuBoard.SetPointOnBoardOccupancyState(illegalMove.point, OccupancyState.IllegalMove);

            float      worldX = illegalMove.point.X;
            float      worldY = 0;
            float      worldZ = illegalMove.point.Y;
            Vector3    worldVector3OfIllegalMove = new Vector3(worldX, worldY, worldZ);
            Quaternion illegalMoveRotation       = GameConfiguration.IsAndroidGame
                ? GameConstants.IllegalMoveQuaternion
                : Quaternion.identity;

            GameObject warning;
            switch (illegalMove.reason)
            {
            case IllegalMoveReason.Double3:
                warning = UnityEngine.Object.Instantiate(Double3Warning, worldVector3OfIllegalMove, illegalMoveRotation);
                WarningObjects.Add(warning);
                break;

            case IllegalMoveReason.Double4:
                warning = UnityEngine.Object.Instantiate(Double4Warning, worldVector3OfIllegalMove, illegalMoveRotation);
                WarningObjects.Add(warning);
                break;

            case IllegalMoveReason.Overline:
                warning = UnityEngine.Object.Instantiate(OverlineWarning, worldVector3OfIllegalMove, illegalMoveRotation);
                WarningObjects.Add(warning);
                break;

            default:
                throw new Exception("Illegal moves must have a 3x3, 4x4, or overline reason!");
            }
        }
    }