Exemple #1
0
    public World(WorldManager manager, int boardSize, Vector3 origin, float scale, float integrity, int id, int hue)
    {
        this.manager      = manager;
        worldColor        = new WorldColor(Random.Range(0, 360));
        this.id           = id;
        this.isActive     = false;
        this.gridObjectId = 0;

        this.origin    = origin;
        this.scale     = scale;
        this.integrity = integrity;
        this.board     = new Board(this, boardSize, origin, scale);
    }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            WorldColor worldColor = (WorldColor)value;

            if (targetType == typeof(System.Windows.Media.Color))
            {
                switch (worldColor)
                {
                case WorldColor.None:
                    return(System.Windows.Media.Colors.White);

                case WorldColor.Red:
                    return(System.Windows.Media.Color.FromRgb(252, 0, 0));

                case WorldColor.Blue:
                    return(System.Windows.Media.Color.FromRgb(0, 213, 255));

                case WorldColor.Green:
                    return(System.Windows.Media.Color.FromRgb(0, 252, 126));

                default:
                    return(System.Windows.Media.Colors.White);
                }
            }
            else if (targetType == typeof(System.Windows.Media.Brush) ||
                     targetType == typeof(System.Windows.Media.SolidColorBrush))
            {
                switch (worldColor)
                {
                case WorldColor.None:
                    return(System.Windows.Media.Brushes.White);

                case WorldColor.Red:
                    return(new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(252, 0, 0)));

                case WorldColor.Blue:
                    return(new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 213, 255)));

                case WorldColor.Green:
                    return(new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 252, 126)));

                default:
                    return(System.Windows.Media.Brushes.White);
                }
            }
            else
            {
                return(worldColor);
            }
        }
Exemple #3
0
    void Start()
    {
        //Debug.Log("LTouch connected " + (OVRInput.GetConnectedControllers() == OVRInput.Controller.LTouch));
        m_scoreText = GameObject.FindGameObjectWithTag("Finish").GetComponent <TextMesh>();

        m_climber    = GetComponent <Climb>();
        m_worldColor = GetComponent <WorldColor>();
        hands.Clear();
        foreach (GameObject hand in GameObject.FindGameObjectsWithTag("Hand"))
        {
            hands.Add(hand);
        }
        Debug.Log("Has " + hands.Count + " hands");
    }
Exemple #4
0
        public World(uint width, uint height, WorldColor color)
        {
            Width  = width;
            Height = height;
            Color  = color;

            // jagged arrays are more performance then their [,] counterparts
            _blocks = new WorldBlock[width][];

            for (var x = 0; x < width; x++)
            {
                _blocks[x] = new WorldBlock[height];
                for (var y = 0; y < height; y++)
                {
                    var b = new WorldBlock();

                    _blocks[x][y] = b;
                }
            }
        }
Exemple #5
0
    // This copy constructor creates a world that is a copy of the original world w.r.t.
    // a new origin, scale, integrity and id.
    // The following are not copied:
    //      - Inhabitants of tiles (This should be done via SpawnGridObject in the world manager).
    //		- The turncontroller (this should be done in the world manager)
    //      - Custom colorings of the tiles (all tiles will reset their coloring).
    public World(World original, Vector3 origin, float scale, float integrity, int id, int hue)
    {
        this.manager      = original.manager;
        worldColor        = new WorldColor(hue);
        this.id           = id;
        this.isActive     = false;
        this.gridObjectId = original.gridObjectId;
        this.origin       = origin;
        this.scale        = scale;
        this.integrity    = integrity;
        this.board        = new Board(original.board, this, this.origin, this.scale);

        this.gridObjects = new List <GridObject>();

        foreach (GridObject g in original.gridObjects)
        {
            this.CopyGridObject(g);
        }

        this.turnController = new TurnController(this, original.turnController);
    }
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ObjectiveType type  = (ObjectiveType)values[0];
            WorldColor    color = (WorldColor)values[1];

            string imagePath = string.Empty;

            switch (type)
            {
            case ObjectiveType.Camp:
                imagePath = @"/Resources/Camp";
                break;

            case ObjectiveType.Tower:
                imagePath = @"/Resources/Tower";
                break;

            case ObjectiveType.Keep:
                imagePath = @"/Resources/Keep";
                break;

            case ObjectiveType.Castle:
                imagePath = @"/Resources/Castle";
                break;

            case ObjectiveType.TempleofLostPrayers:
                imagePath = @"/Resources/templeofLostPrayers";
                break;

            case ObjectiveType.BattlesHollow:
                imagePath = @"/Resources/BattlesHollow";
                break;

            case ObjectiveType.BauersEstate:
                imagePath = @"/Resources/BauersEstate";
                break;

            case ObjectiveType.OrchardOverlook:
                imagePath = @"/Resources/OrchardOverlook";
                break;

            case ObjectiveType.CarversAscent:
                imagePath = @"/Resources/CarversAscent";
                break;

            default:
                break;
            }

            // Append the color
            switch (color)
            {
            case WorldColor.Blue:
                imagePath += "_b";
                break;

            case WorldColor.Green:
                imagePath += "_g";
                break;

            case WorldColor.Red:
                imagePath += "_r";
                break;

            default:
                break;
            }

            // Append the file format (always .png)
            imagePath += ".png";

            return(new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute)));
        }
 public static string ToFriendlyName(this WorldColor wc) => $"{wc} World";
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values[0] is ObjectiveType &&
                values[1] is WorldColor)
            {
                ObjectiveType type  = (ObjectiveType)values[0];
                WorldColor    color = (WorldColor)values[1];

                string imagePath = @"/Images/WvW/";

                // Append the color path
                switch (color)
                {
                case WorldColor.Blue:
                    imagePath += "Blue/";
                    break;

                case WorldColor.Green:
                    imagePath += "Green/";
                    break;

                case WorldColor.Red:
                    imagePath += "Red/";
                    break;

                default:
                    imagePath += "Neutral/";
                    break;
                }

                switch (type)
                {
                case ObjectiveType.Camp:
                    imagePath += "Camp";
                    break;

                case ObjectiveType.Tower:
                    imagePath += "Tower";
                    break;

                case ObjectiveType.Keep:
                    imagePath += "Keep";
                    break;

                case ObjectiveType.Castle:
                    imagePath += "Castle";
                    break;

                case ObjectiveType.Ruin:
                    imagePath += "Ruin";
                    break;

                case ObjectiveType.Mercenary:
                    imagePath += "Mercenary";
                    break;

                case ObjectiveType.Spawn:
                    imagePath += "Spawn";
                    break;

                default:
                    break;
                }

                // Append the file format (always .png)
                imagePath += ".png";

                return(new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute)));
            }
            else
            {
                return(null);
            }
        }
Exemple #9
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values[0] is ObjectiveType &&
                values[1] is WorldColor)
            {
                ObjectiveType type  = (ObjectiveType)values[0];
                WorldColor    color = (WorldColor)values[1];

                string imagePath = @"/Images/WvW/";

                // Append the color path
                switch (color)
                {
                case WorldColor.Blue:
                    imagePath += "Blue/";
                    break;

                case WorldColor.Green:
                    imagePath += "Green/";
                    break;

                case WorldColor.Red:
                    imagePath += "Red/";
                    break;

                default:
                    imagePath += "Neutral/";
                    break;
                }

                switch (type)
                {
                case ObjectiveType.Camp:
                    imagePath += "Camp";
                    break;

                case ObjectiveType.Tower:
                    imagePath += "Tower";
                    break;

                case ObjectiveType.Keep:
                    imagePath += "Keep";
                    break;

                case ObjectiveType.Castle:
                    imagePath += "Castle";
                    break;

                case ObjectiveType.TempleofLostPrayers:
                    imagePath += "TempleofLostPrayers";
                    break;

                case ObjectiveType.BattlesHollow:
                    imagePath += "BattlesHollow";
                    break;

                case ObjectiveType.BauersEstate:
                    imagePath += "BauersEstate";
                    break;

                case ObjectiveType.OrchardOverlook:
                    imagePath += "OrchardOverlook";
                    break;

                case ObjectiveType.CarversAscent:
                    imagePath += "CarversAscent";
                    break;

                default:
                    break;
                }

                // Append the file format (always .png)
                imagePath += ".png";

                return(new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute)));
            }
            else
            {
                return(null);
            }
        }