Пример #1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         predictRotate = new Vector3(enemyCount[0].transform.localPosition.x + gottenSpace, collision.transform.localPosition.y + gottenSpace, 0);
         rotate.RotateToNext(this.transform, predictRotate);
     }
 }
Пример #2
0
    // this update is going to be used by a lot of enemies, this way the update only has one task to loop

    private void DoUpdate()
    {
        _wayPointPos = points._waypoints[i].position;
        _step        = speed * Time.deltaTime;
        thisPos      = transform.position;
        _rotate.RotateToNext(thisTransform, _wayPointPos);
        Move_Towards();
        PickNextPoint();
    }