void Start()
    {
        enemyType = GetComponent <EnemyStats>().GetEnemyType();

        enemyAgent = GetComponent <NavMeshAgent>();

        targetTransform    = GameObject.FindWithTag("Player").GetComponent <Transform>();
        targetBehaviour    = targetTransform.gameObject.GetComponent <CharacterBehaviour>();
        basicAttackTrigger = GetComponentInChildren <AttackTrigger>();
        enemyAnimator      = GetComponentInChildren <Animator>();
        particleInstancer  = GameObject.FindWithTag("ParticleInstancer").GetComponent <ParticleInstancer>();
        enemyAudioPlayer   = GetComponent <AudioPlayer>();

        foreach (AnimationClip clip in enemyAnimator.runtimeAnimatorController.animationClips)
        {
            switch (enemyType)
            {
            case EnemyStats.EnemyType.Skull:
                if (clip.name == "hit")
                {
                    basicAttackDuration = clip.length;
                }
                if (clip.name == "appear")
                {
                    appearDelayTime = clip.length / 1.7f;
                }

                break;

            case EnemyStats.EnemyType.Fenrir:
                if (clip.name == "jumpIn")
                {
                    jumpInitDelayTime = clip.length;
                }
                if (clip.name == "jumpAttack")
                {
                    jumpAttackInitTime = clip.length;
                }

                break;

            default:
                break;
            }
        }

        enemyAgent.SetDestination(transform.position);

        enemySpeed        = enemyAgent.speed;
        enemyAngularSpeed = enemyAgent.angularSpeed;
        enemyAcceleration = enemyAgent.acceleration;

        if (enemyType == EnemyStats.EnemyType.Fenrir)
        {
            baAnimationLength = 5;
        }

        enemyHealthBar = GameObject.Find("GameplayUI").GetComponent <EnemyHealthBar>();
        endingPlayer   = enemyHealthBar.gameObject.GetComponent <PlayEnding>();
    }
Exemplo n.º 2
0
    private void Start()
    {
        playerTransform        = GetComponent <Transform>();
        playerAgent            = GetComponent <NavMeshAgent>();
        hammerBehaviour        = GetComponentInChildren <HammerBehaviour>();
        basicAttackTrigger     = GetComponentInChildren <AttackTrigger>();
        cameraBehaviour        = GameObject.FindWithTag("CameraController").GetComponent <CameraBehaviour>();
        thorAnimator           = GetComponentInChildren <Animator>();
        timeManager            = GameObject.FindWithTag("manager").GetComponent <TimeManager>();
        audioPlayer            = GetComponent <AudioPlayer>();
        musicAmbientController = GameObject.FindWithTag("MusicAmbientController").GetComponent <MusicAmbientController>();

        foreach (AnimationClip animation in thorAnimator.runtimeAnimatorController.animationClips)
        {
            //animationsList.Add(new AnimationClipName(animation.name, animation));

            if (animation.name == "throwHammer")
            {
                throwDuration = animation.length / 1.4f;
            }
            if (animation.name == "hit_01")
            {
                attackDuration = animation.length;
            }
            if (animation.name == "slowArea")
            {
                slowAreaInitDelay = animation.length / 1.3f;
            }
            if (animation.name == "lightboltRain")
            {
                lightRainCastInitDuration = animation.length;
            }
        }

        agentSpeed = playerAgent.speed;

        maxLife         = life;
        playerHealthBar = GameObject.Find("GameplayUI").GetComponent <PlayerHealthBar>();
        StartCoroutine(SetInitLife());

        endingPlayer = playerHealthBar.gameObject.GetComponent <PlayEnding>();

        passiveInitDuration = passiveDuration;

        particleInstancer = GameObject.FindWithTag("ParticleInstancer").GetComponent <ParticleInstancer>();
    }
Exemplo n.º 3
0
 public void SetScripts()
 {
     if (GameObject.FindGameObjectWithTag("Player") != null)
     {
         player             = GameObject.FindWithTag("Player");
         playerBehaviour    = player.GetComponent <CharacterBehaviour>();
         playerCamBehaviour = GameObject.FindGameObjectWithTag("CameraController").GetComponentInChildren <CameraBehaviour>();
         playerCamRaycaster = GameObject.FindGameObjectWithTag("MainCamera").GetComponentInChildren <CameraRaycaster>();
         pauseGameplay      = GameObject.Find("GameplayUI").GetComponent <PauseGameplay>();
         endingPlayer       = pauseGameplay.gameObject.GetComponent <PlayEnding>();
     }
     else
     {
         player             = null;
         playerBehaviour    = null;
         playerCamBehaviour = null;
         playerCamRaycaster = null;
         pauseGameplay      = null;
         endingPlayer       = null;
     }
 }