Example #1
0
    // Update is called once per frame
    void Update()
    {
        var enemyPos = GameContext.Instance.ships[ChooseEnemyIndex()].position;

        if (!TargetInCone(enemyPos, 20))
        {
            if (idx % 5 == 0)
            {
                if (right)
                {
                    target.RotateRight();
                }
                else
                {
                    target.RotateLeft();
                }
            }
        }
        idx++;
        if (idx % 15 == 0)
        {
            target.Shot();
        }
        if (true)
        {
            target.Accelerate();
        }
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.LeftArrow))
     {
         target.RotateLeft();
     }
     if (Input.GetKey(KeyCode.RightArrow))
     {
         target.RotateRight();
     }
     if (Input.GetKey(KeyCode.UpArrow))
     {
         target.Accelerate();
     }
     if (Input.GetKey(KeyCode.Space))
     {
         target.Shot();
     }
 }
 // Update is called once per frame
 void Update()
 {
     target.Shot();
     target.RotateLeft();
 }