Пример #1
0
    void OnTargetReachedEvent(ProjectileBehaviour thisProjectile)
    {
        Vector2 playerPos  = player.transform.position;
        Vector2 playerStep = playerPos - new Vector2(thisProjectile.gameObject.transform.position.x, thisProjectile.gameObject.transform.position.y);

        playerStep = playerStep.normalized * 20f;

        thisProjectile.SetTarget(playerStep);
    }
Пример #2
0
 private void SpawnSettings()
 {
     projectileInstance = Instantiate(batPrefab, houseSpawner.houses[Random.Range(0, houseSpawner.houses.Count)], Quaternion.identity);
     projectileInstance.SetTarget(houseSpawner.houses[Random.Range(0, houseSpawner.houses.Count)]);
     projectileInstance.TargetReachedEvent += OnTargetReachedEvent;
 }