Пример #1
0
    private void Awake()
    {
        chasingState   = new ChasingState(this);
        idleState      = new EnemyIdleState(this);
        returningState = new ReturningState(this);
        attackingState = new AttackingState(this);
        visiblePlayers = new List <GameObject>();

        returnPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);

        eyes         = transform.FindChild("Eyes");
        health       = GetComponent <EnemyHealth>();
        attack       = GetComponent <EnemyAttack>();
        sounds       = GetComponent <EnemySoundController>();
        animator     = GetComponent <EnemyAnimationController>();
        navMeshAgent = GetComponent <NavMeshAgent>();

        isTargetting = false;

        if (transform.parent.CompareTag("EnemyMob"))
        {
            mobKnowledge = GetComponentInParent <EnemyMobKnowledge>();
        }

        tm = GameObject.FindWithTag("TeamManager").GetComponent <TeamManager>();
    }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        animator     = GetComponent <BossAnimationController>();
        sound        = GetComponent <EnemySoundController>();
        tm           = GameObject.FindGameObjectWithTag("TeamManager").GetComponent <TeamManager>();
        turningTimer = timeSpentTurning;

        animator.AnimateIdle();
    }
Пример #3
0
 public void Init(GameObject manager)
 {
     dead = false;
     Transform info = transform.FindChild("EnemyInfo");
     healthMeter = info.FindChild("HealthMeter").GetComponent<Image>();
     healthText = info.FindChild("HealthText").GetComponent<Text>();
     em = manager.GetComponent<EnemyManager>();
     am = manager.GetComponent<AnnouncementManager>();
     esc = GetComponent<EnemySoundController>();
     HealthInit();
     UpdateHealthInfo ();
 }
Пример #4
0
    void Start()
    {
        player        = GameObject.FindGameObjectWithTag("Player");
        playerInSight = false;
        col           = GetComponent <SphereCollider>();
        animator      = this.GetComponent <Animator>();
        soundManager  = this.GetComponent <EnemySoundController>();

        agent          = GetComponent <NavMeshAgent>();
        wanderingAgent = new WanderingManagement();



        wasPlayerSeen = false;
        SetWanderingDestination();
    }
 public void InitActions(GameObject manager)
 {
     esc = GetComponent<EnemySoundController> ();
     em = manager.GetComponent<EnemyManager>();
 }
Пример #6
0
    /// <summary>
    /// Initialize Script
    /// </summary>
    public virtual void Init(EnemyManager _enemyMng)
    {
        graphics      = GetComponentInChildren <EnemyGraphicController>();
        enemyMng      = _enemyMng;
        startPosition = transform.position;
        startRotation = transform.rotation;

        ResetLife();
        ResetStunHit();
        ResetPosition();
        SetCanStun(true);

        // Initialize Enemy State Machine
        enemySM = GetComponent <EnemySMController>();
        if (enemySM != null)
        {
            enemySM.Init(this);
        }

        toleranceCtrl = GetComponent <EnemyToleranceController>();
        if (toleranceCtrl != null)
        {
            toleranceCtrl.Init();
        }

        collisionCtrl = GetComponent <EnemyCollisionController>();
        if (collisionCtrl != null)
        {
            collisionCtrl.Init();
        }

        movementCtrl = GetComponent <EnemyMovementController>();
        if (movementCtrl != null)
        {
            movementCtrl.Init(collisionCtrl);
        }

        animCtrl = GetComponentInChildren <EnemyAnimationController>();
        if (animCtrl != null)
        {
            animCtrl.Init(this);
        }

        commandsSpriteCtrl = GetComponentInChildren <EnemySpriteController>();
        if (commandsSpriteCtrl != null)
        {
            commandsSpriteCtrl.Init(this);
        }

        vfxCtrl = GetComponentInChildren <EnemyVFXController>();
        if (vfxCtrl != null)
        {
            vfxCtrl.Init(this);
        }

        sfxCtrl = GetComponentInChildren <EnemySoundController>();
        if (sfxCtrl != null)
        {
            sfxCtrl.Setup(this);
            sfxCtrl.Init();
        }

        viewCtrl = GetComponent <EnemyViewController>();
        if (viewCtrl != null)
        {
            viewCtrl.Init();
        }

        CalculatePathLenght();
    }
    void Start()
    {
        layerMask = (1 << 9);
        layerMask |= Physics.IgnoreRaycastLayer;
        layerMask = ~layerMask;

        thisScript = GetComponent<EnemyActionsSecond>();
        move = GetComponent<EnemyMovement>();
        animator = gameObject.GetComponentInChildren<Animator>();

        shotLifetime = 4.0f;
        shotPrefab = (GameObject)Resources.Load("EnemyShot");

        if (actionDamage == 0) {
            actionDamage = 5;
        }

        esc = GetComponent<EnemySoundController>();
    }