Beispiel #1
0
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
        {
            TypPowierzchni type = (TypPowierzchni)value;

            switch (type)
            {
            case TypPowierzchni.Unknown:
                return(new SolidColorBrush(Colors.LightGray));

            case TypPowierzchni.Water:
                return(new SolidColorBrush(Colors.LightBlue));

            case TypPowierzchni.WaterHit:
                return(new SolidColorBrush(Colors.Blue));

            case TypPowierzchni.Grass:
                return(new SolidColorBrush(Colors.LightGreen));

            case TypPowierzchni.GrassHit:
                return(new SolidColorBrush(Colors.Green));

            case TypPowierzchni.Undamaged:
                return(new SolidColorBrush(Colors.Black));

            case TypPowierzchni.Damaged:
                return(new SolidColorBrush(Colors.Orange));

            case TypPowierzchni.Destroyed:
                return(new SolidColorBrush(Colors.Red));
            }

            throw new Exception("fail");
        }
Beispiel #2
0
        protected void Strzelaj(int row, int col, Player otherPlayer)
        {
            //incrase number of shots and set number of enemy units
            _shots++;
            MainWindow._mainWindow.UpdateTb(_shots, _enemyUnits);

            int            damagedIndex;
            bool           isDestroyed;
            TypPowierzchni newType = otherPlayer.FiredAt(row, col, out damagedIndex, out isDestroyed);

            EnemyGrid[row][col].SquareIndex = damagedIndex;

            if (isDestroyed)
            {
                EnemyDestroyed(damagedIndex);
            }
            else
            {
                EnemyGrid[row][col].Type = newType;
            }
        }
Beispiel #3
0
 public void Reset(TypPowierzchni type, ObiektNaPlanszy objectType)
 {
     ObjectType  = objectType;
     Type        = type;
     SquareIndex = -1;
 }