Beispiel #1
0
 static void EnemyMove(Tank enemy, Tank player)
 {
     if (enemy.Health.IsMax)
     {
         enemy.Shoot(player);
     }
     else
     {
         Random r = new Random();
         if (0.5f > r.NextDouble())
         {
             enemy.Shoot(player);
         }
         else
         {
             enemy.Repair();
         }
     }
 }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.W))
     {
         target.SetMove(1f * Time.deltaTime);
     }
     if (Input.GetKey(KeyCode.S))
     {
         target.SetMove(-1f * Time.deltaTime);
     }
     if (Input.GetKey(KeyCode.A))
     {
         target.SetRotate(-1f * Time.deltaTime);
     }
     if (Input.GetKey(KeyCode.D))
     {
         target.SetRotate(1f * Time.deltaTime);
     }
     if (Input.GetKey(KeyCode.Space))
     {
         target.Shoot();
     }
 }