Exemplo n.º 1
0
 void Start()
 {
     nav          = GetComponent <NavMeshAgent>();
     player       = GameObject.FindGameObjectWithTag("Player").transform;
     enemy        = GetComponent <BlueEnemy>();
     bezierWalker = GetComponent <BezierWalkerWithSpeed>();
     destinationPoint.SetParent(null);
     startPoint = RandomPointOnSphere();
     nav.SetDestination(startPoint);
     destinationPoint.position = startPoint;
 }
Exemplo n.º 2
0
    /// <summary>
    /// At the beginning, we get the ennemy components such as NavMeshAgent and EnnemyAttack
    /// We also get an instance of the player and the distance to the player
    /// </summary>
    private void Start()
    {
        player       = GameObject.FindGameObjectWithTag("Player").transform;
        enemy        = GetComponent <BlueEnemy>();
        nav          = GetComponent <NavMeshAgent>();
        distToPlayer = Vector3.Distance(player.position, transform.position);
        //for pattern

        /*move = GetComponent<BezierWalkerWithSpeed>();
         * move.enabled = false;*/
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        if (em == null)
        {
            em = this.gameObject.GetComponent <EnemyManager>();
        }

        red              = enemyRed.GetComponent <RedEnemy> ();
        blue             = enemyBlue.GetComponent <BlueEnemy> ();
        pink             = enemyPink.GetComponent <PinkEnemy> ();
        orange           = enemyOrange.GetComponent <OrangeEnemy> ();
        playercontroller = player.GetComponent <PlayerController> ();
        red.activate();
        //Set the basic mode into 3, going around
        setMode3();
    }
Exemplo n.º 4
0
    /// <summary>
    /// Dealing damage if other of player
    /// </summary>
    /// <param name="other">An Enemy</param>
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <BlueBullet>() || other.CompareTag("Player"))
        {
            return;
        }

        //OnHitParticleSystem(); Same, not created yet

        if (other.GetComponent <BlueEnemy>())
        {
            BlueEnemy target = other.GetComponent <BlueEnemy>();
            target.TakeDamage(damage, this.type);
        }

        Destroy(gameObject);
    }
Exemplo n.º 5
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("RedEnemy"))
        {
            RedEnemy enemy = other.GetComponentInParent <RedEnemy>();
            enemy.TakeDamage(DamageQuantity(other), "explosion");
        }
        if (other.CompareTag("BlueEnemy"))
        {
            BlueEnemy enemy = other.GetComponentInParent <BlueEnemy>();
            enemy.TakeDamage(DamageQuantity(other), "explosion");
        }
        if (other.CompareTag("Player"))
        {
            PlayerHealth player = other.GetComponentInParent <PlayerHealth>();
            player.TakeDamage(DamageQuantity(other));
        }

        PushBack(other);
        ExplosionEnd();
    }
Exemplo n.º 6
0
    IEnumerator SpawnEnemies()
    {
        while (true)
        {
            Enemy newEnemy;

            if (Random.Range(0, 2) == 0)
            {
                newEnemy = new BlueEnemy(enemyGameObject);
            }
            else
            {
                newEnemy = new RedEnemy(enemyGameObject);
            }

            newEnemy.gameObject.transform.position = new Vector3(32f, -4f, 0f);
            instantiatedEnemies.Add(newEnemy);

            yield return(new WaitForSeconds(2f));
        }
    }