示例#1
0
    void killBoss()
    {
        if (isDead)
        {
            return;
        }

        isDead = true;

        GameObject deathFxParticle = (GameObject)Instantiate(bossDeathFX);

        // Reposition the particle emitter at the same position as dropFXSpawnPoint
        deathFxParticle.transform.position = dropFXSpawnPoint.transform.position;

        // Call the bossDied event and give it a score of 1000
        if (bossDied != null)
        {
            bossDied(1000);
        }

        transform.position = inActiveNode.transform.position;

        currentEvent      = BossEventController.bossEvents.inactive;
        timeForNextEvent  = 0.0f;
        enemiesLeftToKill = enemiesToStartBattle;
    }
    void killBoss()
    {
        if (isDead)
        {
            return;
        }

        isDead = true;
        //Implementar sistema de partícules de destrucció del Boss: bossDeathFX


        if (bossDied != null)
        {
            //bossDied(1000);

            // Tornar a posició inactiva inicial
            transform.position = inActiveNode.transform.position;
        }

        //Reset de camps de control
        currentEvent      = BossEventController.bossEvents.inactive;
        timeForNextEvent  = 0.0f;
        enemiesLeftToKill = enemiesToStartBattle;
        health            = startHealth;
    }
 public void beginBossBattle()
 {
     // Establir node inicial i fer que el Boss hi caigui
     targetNode   = dropToStartNode;
     currentEvent = bossEvents.fallingToNode;
     // Inicialitzar variables de control
     timeForNextEvent = 0.0f;
     health           = startHealth;
     isDead           = false;
 }
示例#4
0
    /**
     * Every action calls this method at the end to initiate the next action
     * according to the selected bossSequence.
     *
     * It also ends the coroutineStarted check so it will start the next
     * action in Update()
     */
    private void SetNextAction()
    {
        currentEvent = bossSequenceList[bossSequenceListValue];
        bossSequenceListValue++;

        if (bossSequenceListValue >= bossSequenceList.size) // ListValue starts at 0, List.size starts at 1
        {
            bossSequenceListValue = 0;
        }
        coroutineStarted = false;
    }
示例#5
0
    public void beginBossBattle()
    {
        // Set the first falling node and have the boss fall towards it
        targetNode   = dropToStartNode;
        currentEvent = bossEvents.fallingToNode;

        // Reset various control variables used to track the boss battle
        timeForNextEvent = 0.0f;
        health           = startHealth;
        isDead           = false;
    }
    public void beginBossBattle()
    {
        // Set the first falling node and have the boss fall towards it
          targetNode = dropToStartNode;
          currentEvent = bossEvents.fallingToNode;

          // Reset various control variables used to track the boss battle
          timeForNextEvent = 0.0f;
          health = startHealth;
          isDead = false;
    }
示例#7
0
    public void beginBossBattle()
    {
        if (onCameraTargetChange != null)
        {
            onCameraTargetChange();
        }

        bossCameraTarget.target = this.transform;
        targetNode = dropToStartNode;
        CurrEvent  = bossEvents.fallingToNode;

        timeForNextEvent = 0.0f;
        startHealth      = health;
        Canvas.SetActive(true);
    }
示例#8
0
    void Update()
    {
        switch (currentEvent)
        {
        case bossEvents.inactive:
            // Not doing anything, so nothing to do.
            break;

        case bossEvents.fallingToNode:
            if (transform.position.y > targetNode.transform.position.y)
            {
                // Movespeed here is negtive, so the object moves downwards
                transform.Translate(new Vector3(0f, -moveSpeed * Time.deltaTime, 0f));
                if (transform.position.y < targetNode.transform.position.y)
                {
                    Vector3 targetPos = targetNode.transform.position;
                    transform.position = targetPos;
                }
            }
            else
            {
                // Create the 'Hit Ground' smoke FX
                createDropFX();

                timeForNextEvent = 0.0f;
                currentEvent     = bossEvents.waitingToJump;
            }
            break;

        case bossEvents.waitingToFall:
            // Boss is waiting to fall to another node
            if (timeForNextEvent == 0.0f)
            {
                timeForNextEvent = Time.time + eventWaitDelay;
            }
            else if (timeForNextEvent < Time.time)
            {
                // Need to find a new node!
                targetNode = dropNodeList[Random.Range(0, dropNodeList.Count)];

                // Set the boss position to the sky position of this node
                transform.position = getSkyPositionOfNode(targetNode);

                // Set the event state
                currentEvent     = bossEvents.fallingToNode;
                timeForNextEvent = 0.0f;
            }
            break;

        case bossEvents.waitingToJump:
            // Boss is on a platform and is just waiting to jump off of it
            if (timeForNextEvent == 0.0f)
            {
                timeForNextEvent = Time.time + eventWaitDelay;
            }
            else if (timeForNextEvent < Time.time)
            {
                // Build the target position based on the current node
                targetPosition = getSkyPositionOfNode(targetNode);

                // Set our event state
                currentEvent     = bossEvents.jumpingOffPlatform;
                timeForNextEvent = 0.0f;

                // Also set the target node to null so we know to find a random one when it's time to fall to one again
                targetNode = null;
            }
            break;

        case bossEvents.jumpingOffPlatform:
            if (transform.position.y < targetPosition.y)
            {
                // Movespeed is positive here, causing the object to move upwards
                transform.Translate(new Vector3(0f, moveSpeed * Time.deltaTime, 0f));

                if (transform.position.y > targetPosition.y)
                {
                    transform.position = targetPosition;
                }
            }
            else
            {
                timeForNextEvent = 0.0f;
                currentEvent     = bossEvents.waitingToFall;
            }
            break;
        }
    }
    void Update()
    {
        if (currentEvent == bossEvents.inactive)
        {
        }
        else
        {
        }
        switch (currentEvent)
        {
        case bossEvents.inactive:
            // Not doing anything, so nothing to do.
            break;

        case bossEvents.fallingToNode:
            if (transform.position.y > targetNode.transform.position.y)
            {
                // Velocitat negativa, per desplaçar-se cap abaix
                transform.Translate(new Vector3(0f, -moveSpeed *
                                                Time.deltaTime, 0f));
                if (transform.position.y <
                    targetNode.transform.position.y)
                {
                    Vector3 targetPos =
                        targetNode.transform.position;
                    transform.position = targetPos;
                }
            }
            else
            {
                // Crear efecte d'aterratge (Partícules)
                createDropFX();

                timeForNextEvent = 0.0f;
                currentEvent     = bossEvents.waitingToJump;
            }
            break;

        case bossEvents.waitingToFall:
            // Boss esperant per caure en un altre node
            if (timeForNextEvent == 0.0f)
            {
                timeForNextEvent = Time.time + eventWaitDelay;
            }
            else if (timeForNextEvent < Time.time)
            {
                // Need to find a new node!
                targetNode = dropNodeList[Random.Range(0, dropNodeList.Count)];

                // Posició del Boss SOBRE el node destí
                transform.position = getSkyPositionOfNode(targetNode);

                // actualitzar estat
                currentEvent     = bossEvents.fallingToNode;
                timeForNextEvent = 0.0f;
            }
            break;

        case bossEvents.waitingToJump:
            // Boss espera, situat sobre plataforma, el moment de canviar
            if (timeForNextEvent == 0.0f)
            {
                timeForNextEvent = Time.time + eventWaitDelay;
            }
            else if (timeForNextEvent < Time.time)
            {
                // Estableix posició objetiu per elevar-se sobre node actual
                targetPosition = getSkyPositionOfNode(targetNode);

                // Actualitzar estat
                currentEvent     = bossEvents.jumpingOffPlatform;
                timeForNextEvent = 0.0f;

                targetNode = null;
            }
            break;

        case bossEvents.jumpingOffPlatform:
            if (transform.position.y < targetPosition.y)
            {
                // Velocitat positiva, moviment ascendent
                transform.Translate(new Vector3(0f, moveSpeed *
                                                Time.deltaTime, 0f));
                if (transform.position.y > targetPosition.y)
                {
                    transform.position = targetPosition;
                }
            }
            else
            {
                timeForNextEvent = 0.0f;
                currentEvent     = bossEvents.waitingToFall;
            }
            break;
        }
        if (health <= 0)
        {
            Debug.Log("Killing Boss");
            // Crear l'objecte emissor de partícules
            ParticleSystem deathFxParticle =
                (ParticleSystem)Instantiate(deathFxParticlePrefab);
            // Obtenir la posició de l'enemic
            Vector3 bossPos = transform.position;
            // Crear un nou vector davant de l'enemic (incrementar component z)
            Vector3 particlePosition =
                new Vector3(bossPos.x, bossPos.y, bossPos.z + 1.0f);
            // Posicionar l'emissor de partícules en aquesta nova posició
            deathFxParticle.transform.position = particlePosition;
            // Generar l'event “bossDied” amb una puntuació de 1000 punts
            ScoreWatcher2.addScore(1000);
            health = startHealth;
            bossDied(1000);
            killBoss();
        }
    }
    void Update()
    {
        switch(currentEvent)
        {
            case bossEvents.inactive:
                // Not doing anything, so nothing to do.
            break;

            case bossEvents.fallingToNode:
                if(transform.position.y > targetNode.transform.position.y)
                {
                    // Movespeed here is negtive, so the object moves downwards
                    transform.Translate(new Vector3(0f, -moveSpeed * Time.deltaTime, 0f));
                    if(transform.position.y < targetNode.transform.position.y)
                    {
                        Vector3 targetPos = targetNode.transform.position;
                        transform.position = targetPos;
                    }
                }
                else
                {
                    // Create the 'Hit Ground' smoke FX
                    createDropFX();

                    timeForNextEvent = 0.0f;
                    currentEvent = bossEvents.waitingToJump;
                }
               break;

                case bossEvents.waitingToFall:
                    // Boss is waiting to fall to another node
                    if(timeForNextEvent == 0.0f)
                    {
                         timeForNextEvent = Time.time + eventWaitDelay;
                    }
                    else if(timeForNextEvent < Time.time)
                    {
                         // Need to find a new node!
                         targetNode = dropNodeList[ Random.Range(0,dropNodeList.Count) ];

                         // Set the boss position to the sky position of this node
                         transform.position = getSkyPositionOfNode(targetNode);

                         // Set the event state
                         currentEvent = bossEvents.fallingToNode;
                         timeForNextEvent = 0.0f;
                    }
               break;

               case bossEvents.waitingToJump:
                    // Boss is on a platform and is just waiting to jump off of it
                    if(timeForNextEvent == 0.0f)
                    {
                         timeForNextEvent = Time.time + eventWaitDelay;
                    }
                    else if(timeForNextEvent < Time.time)
                    {
                         // Build the target position based on the current node
                         targetPosition = getSkyPositionOfNode(targetNode);

                         // Set our event state
                         currentEvent = bossEvents.jumpingOffPlatform;
                         timeForNextEvent = 0.0f;

                         // Also set the target node to null so we know to find a random one when it's time to fall to one again
                         targetNode = null;
                    }
               break;

               case bossEvents.jumpingOffPlatform:
                    if(transform.position.y < targetPosition.y)
                    {
                        // Movespeed is positive here, causing the object to move upwards
                        transform.Translate(new Vector3(0f, moveSpeed * Time.deltaTime, 0f));

                         if(transform.position.y > targetPosition.y)
                            transform.position = targetPosition;
                    }
                    else
                    {
                         timeForNextEvent = 0.0f;
                         currentEvent = bossEvents.waitingToFall;
                    }
               break;
          }
    }
    void killBoss()
    {
        if(isDead)
            return;

        isDead = true;

        GameObject deathFxParticle = (GameObject)Instantiate(bossDeathFX);

        // Reposition the particle emitter at the same position as dropFXSpawnPoint
        deathFxParticle.transform.position = dropFXSpawnPoint.transform.position;

        // Call the bossDied event and give it a score of 1000
        if(bossDied != null)
            bossDied(1000);

        transform.position = inActiveNode.transform.position;

        currentEvent = BossEventController.bossEvents.inactive;
        timeForNextEvent = 0.0f;
        enemiesLeftToKill = enemiesToStartBattle;
    }
示例#12
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(enemiesLeftToKill);
        switch (CurrEvent)
        {
        case bossEvents.inactive:
            break;

        case bossEvents.fallingToNode:
        {
            if (transform.position.y > targetNode.transform.position.y)
            {
                transform.Translate(new Vector3(0f, -MoveSpeed * Time.deltaTime, 0f));

                if (transform.position.y < targetNode.transform.position.y)
                {
                    Vector3 targetPos = targetNode.transform.position;
                    transform.position = targetPos;
                }
            }
            else
            {
                createDropFX();
                timeForNextEvent = 0.0f;
                CurrEvent        = bossEvents.waitingToJump;
            }
        }
        break;

        case bossEvents.waitingToFall:
        {
            if (timeForNextEvent == 0.0f)
            {
                timeForNextEvent = Time.time + eventWaitDelay;
            }
            else if (timeForNextEvent < Time.time)
            {
                targetNode         = dropNodeList[Random.Range(0, dropNodeList.Count)];
                transform.position = getSkyPositionOfNode(targetNode);
                CurrEvent          = bossEvents.fallingToNode;
                timeForNextEvent   = 0.0f;
            }
        }
        break;

        case bossEvents.waitingToJump:
        {
            if (timeForNextEvent == 0.0f)
            {
                timeForNextEvent = Time.time + eventWaitDelay;
                animController.SetBool("Spread", true);
            }
            else if (timeForNextEvent < Time.time)
            {
                animController.SetBool("Spread", false);
                targetPosition   = getSkyPositionOfNode(targetNode);
                CurrEvent        = bossEvents.jumpingOffPlatform;
                timeForNextEvent = 0.0f;
                targetNode       = null;
            }
        }
        break;

        case bossEvents.jumpingOffPlatform:
        {
            if (transform.position.y < targetPosition.y)
            {
                transform.Translate(new Vector3(0f, MoveSpeed * Time.deltaTime, 0f));

                if (transform.position.y > targetPosition.y)
                {
                    transform.position = targetPosition;
                }
                else
                {
                    timeForNextEvent = 0.0f;
                    CurrEvent        = bossEvents.waitingToFall;
                }
            }
        }
        break;
        }
    }