// Start is called before the first frame update
 void Start()
 {
     health   = maxHealth;
     aliveVar = GetComponent <AliveOrDeath>();
     AliveOrNot(true);
     anim           = GetComponentInChildren <Animator>();
     sceneLoaderVar = FindObjectOfType <SceneLoader>();
 }
Exemple #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        AliveOrDeath aliveOrDeath = collision.GetComponent <AliveOrDeath>();

        if (aliveOrDeath != null)
        {
            if (aliveOrDeath.alive)
            {
                LeanPool.Despawn(gameObject);
            }
        }
        else
        {
            LeanPool.Despawn(gameObject);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        player          = FindObjectOfType <Player>();
        player.onDeath += onPlayerDeath;

        //movement = GetComponent<ZombieMovement>();
        movement = GetComponent <AIPath>();
        target   = GetComponent <AIDestinationSetter>();
        anim     = GetComponentInChildren <Animator>();
        rb       = GetComponent <Rigidbody2D>();

        //Debug.Log(Mathf.Cos(Mathf.PI));
        //Debug.Log(gameObject.name + " : " + transform.up);
        //Vector3 newUP  = new Vector3 ;
        //Debug.Log(gameObject.name + " : " + RotateVector(transform.up, 360f));


        health = maxHealth;
        onHealthChanged();
        aliveVar = GetComponent <AliveOrDeath>();
        AliveOrNot(true);

        rZone = FindObjectsOfType <RescueZone>();

        if (finalBoss)
        {
            ActivateRescueZone(false);
        }



        previousPoint      = Instantiate(pointPrefab, transform.position, Quaternion.identity);
        currentPatrolPoint = 0;

        if (patrolPoints.Length <= 1)
        {
            activeBehavior     = BaseBehavior.GUARD;
            startGuardRotation = new Vector3(transform.up.x, transform.up.y, 0);
        }
        else if (patrolPoints.Length > 1)
        {
            activeBehavior = BaseBehavior.PATROLING;
        }
        canAttack = true;
        ChangeState(ZombieStates.RETURN);
    }
 // Start is called before the first frame update
 void Start()
 {
     aliveOrDeath = GetComponent <AliveOrDeath>();
     rb           = GetComponent <Rigidbody2D>();
     anim         = GetComponentInChildren <Animator>();
 }
Exemple #5
0
 // Start is called before the first frame update
 void Start()
 {
     anim     = GetComponentInChildren <Animator>();
     aliveVar = GetComponent <AliveOrDeath>();
     AliveOrNot(true);
 }