private void EnemyShoot()
 {
     if (Row0.Count > 0)
     {
         int        i     = Random.Range(0, Row0.Count - 1);
         GameObject enemy = Row0.ElementAt(i);
         enemy.SendMessage("Shoot");
     }
     else if (Row1.Count > 0)
     {
         int        i     = Random.Range(0, Row1.Count - 1);
         GameObject enemy = Row1.ElementAt(i);
         enemy.SendMessage("Shoot");
     }
     else if (Row2.Count > 0)
     {
         int        i     = Random.Range(0, Row2.Count - 1);
         GameObject enemy = Row2.ElementAt(i);
         enemy.SendMessage("Shoot");
     }
     else if (Row3.Count > 0)
     {
         int        i     = Random.Range(0, Row3.Count - 1);
         GameObject enemy = Row3.ElementAt(i);
         enemy.SendMessage("Shoot");
     }
     else if (Row4.Count > 0)
     {
         int        i     = Random.Range(0, Row4.Count - 1);
         GameObject enemy = Row4.ElementAt(i);
         enemy.SendMessage("Shoot");
     }
 }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <param name="factor"></param>
 /// <returns></returns>
 public Matrix4d LerpTo(Matrix4d other, double factor)
 {
     return(CreateFromRows(
                Row0.LerpTo(other.Row0, factor),
                Row1.LerpTo(other.Row1, factor),
                Row2.LerpTo(other.Row2, factor),
                Row3.LerpTo(other.Row3, factor)));
 }
    private void SpawnRows()
    {
        for (int row = 0; row < enemyRows; row++)
        {
            for (int enemiesInRow = 0; enemiesInRow < enemiesPerRow; enemiesInRow++)
            {
                GameObject enemyPrefab = attackerPrefab;
                if ((row == 2) || (row == 3))
                {
                    enemyPrefab = hornetPrefab;
                }
                else if (row == 4)
                {
                    enemyPrefab = bomberPrefab;
                }
                Vector3    position = firstEnemyPosition + (enemiesInRow * horizontalGap) + (row * verticalGap);
                GameObject enemy    = Instantiate(enemyPrefab, position, Quaternion.Euler(0, 0, 0));

                switch (row)
                {
                case 0:
                    Row0.Add(enemy);
                    break;

                case 1:
                    Row1.Add(enemy);
                    break;

                case 2:
                    Row2.Add(enemy);
                    break;

                case 3:
                    Row3.Add(enemy);
                    break;

                case 4:
                    Row4.Add(enemy);
                    break;

                default:
                    break;
                }
                enemy.SendMessage("ChangeSpeed", initialEnemySpeed);
            }
        }
    }
Beispiel #4
0
        private void UpdateRect(object sender, ElapsedEventArgs e)
        {
            Application.Current.Dispatcher.Invoke(
                delegate {
                var mousePos = FormsControl.MousePosition;

                _cropRegion.X2 = mousePos.X;
                _cropRegion.Y2 = mousePos.Y;

                Row0.SetValue(RowDefinition.HeightProperty, new GridLength(_cropRegion.TopLeft.Y + TopLeftOffset, GridUnitType.Pixel));
                Row1.SetValue(RowDefinition.HeightProperty, new GridLength(_cropRegion.BottomRight.Y - _cropRegion.TopLeft.Y, GridUnitType.Pixel));
                Row2.SetValue(RowDefinition.HeightProperty, new GridLength(1, GridUnitType.Star));
                Col0.SetValue(ColumnDefinition.WidthProperty, new GridLength(_cropRegion.TopLeft.X + TopLeftOffset, GridUnitType.Pixel));
                Col1.SetValue(ColumnDefinition.WidthProperty, new GridLength(_cropRegion.BottomRight.X - _cropRegion.TopLeft.X, GridUnitType.Pixel));
                Col2.SetValue(ColumnDefinition.WidthProperty, new GridLength(1, GridUnitType.Star));
            }
                );
        }
Beispiel #5
0
 public override string ToString()
 {
     return(Row0.ToString() + "\n" + Row1.ToString() + "\n" + Row2.ToString() + "\n" + Row3.ToString());
 }
Beispiel #6
0
 /// <summary>
 /// Returns the hashcode for this instance.
 /// </summary>
 /// <returns>A System.Int32 containing the unique hashcode for this instance.</returns>
 public override int GetHashCode()
 {
     return(Row0.GetHashCode() ^ Row1.GetHashCode());
 }