Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        onEnterBattle += OnEnterBatleCallback;
        onExitBattle  += OnExitBatleCallback;

        if (playerCharacter != null)
        {
            playerCharacterInterface = playerCharacter.GetComponent <ICharacter>();
            playerCharacter.onAnimFinished.AddListener(OnPlayerAnimFinishedCallback); //Add call back funtion to player anim fisnihed
        }

        if (enemyCharacter != null)
        {
            enemyCharacterInterface = enemyCharacter.GetComponent <ICharacter>();
            enemyCharacter.onAnimFinished.AddListener(OnEnemyAnimFinishedCallback); //Add call back funtion to player anim fisnihed
        }
    }
Esempio n. 2
0
    void Update()
    {
        _timeSinceLastSpawn += Time.deltaTime;

        if (_timeSinceLastSpawn > _nextSpawn)
        {
            EnemyCharacter enemy = Instantiate(_enemyPrefab) as EnemyCharacter;
            enemy.transform.position = transform.position;

            AITracker tracker = enemy.GetComponent <AITracker>();
            if (tracker != null)
            {
                GameObject player = GameObject.Find("Player");
                tracker.SetTarget(player);
            }

            ResetTimer();
        }
    }