예제 #1
0
    void DestroyAlien()
    {
        GameObject      go    = GameObject.Find("Alien_Exp_Sound");
        Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();

        ascpt.alien_expl.Play();
        //go.audio.Play();
        //scscpt.audio.PlayOneShot(scscpt.alien_explosion);
        //scscpt.alien_expl.Play();
        Instantiate(explosion, transform.position, transform.rotation);
        Destroy(gameObject);
    }
예제 #2
0
    public void removeStar(int explosion_type)
    {
        gscpt.stars_destroyed++;

        GameObject      go    = GameObject.Find("Alien_Exp_Sound");
        Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();

        ascpt.star_explosion.Play();
        //Debug.Break();
        //Explodes the star, and makes it impossible to be targeted again
        if (explosion_type == BIG_EXPLOSION)
        {
            if (c == Color.red)
            {
                Instantiate(red_explosion, transform.position, transform.rotation);
            }
            else if (c == Manager.orange)
            {
                Instantiate(orange_explosion, transform.position, transform.rotation);
            }
            else if (c == Color.yellow)
            {
                Instantiate(yellow_explosion, transform.position, transform.rotation);
            }
            else if (c == Manager.green)
            {
                Instantiate(green_explosion, transform.position, transform.rotation);
            }
            else if (c == Color.blue)
            {
                Instantiate(blue_explosion, transform.position, transform.rotation);
            }
            else if (c == Manager.purple)
            {
                Instantiate(purple_explosion, transform.position, transform.rotation);
            }
            else if (c == Manager.aqua)
            {
                Instantiate(aqua_explosion, transform.position, transform.rotation);
            }
        }
        collider.enabled = false;
        orbitRadius      = 0;
        is_moving        = false;
        renderer.enabled = false;
        r.light.enabled  = false;
        //move under the board so you definitely can't orbit it
        transform.position = new Vector3(0, 0, -500);
        is_destroyed       = true;
    }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C) && gscpt.capac_ammo > 0 && !Manager.is_being_attacked)
        {
            //one shot major energy boost
            Manager.energy += BOOST_SIZE;

            //sound
            GameObject      go    = GameObject.Find("Alien_Exp_Sound");
            Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();
            ascpt.boost.Play();

            //decrease remaining boosts
            gscpt.capac_ammo--;
        }
    }
예제 #4
0
    void OnCollisionEnter(Collision c)
    {
        if (c.transform.name == "Learth(Clone)")
        {
            is_activated = true;
            start_time   = Time.time;

            GameObject      go    = GameObject.Find("Alien_Exp_Sound");
            Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();
            ascpt.invinc.Play();

            //make gameobject too small to hit while script is running (then it gets destoryed later)
            transform.localScale -= transform.localScale;

            //particle trail for learth
            Destroy(Manager.lt);
            Manager.lt = Instantiate(invinc_trail, Manager.l.transform.position, Manager.l.transform.rotation) as GameObject;
            Manager.lt.transform.parent = Manager.l.transform;
        }
    }
예제 #5
0
    void OnCollisionEnter(Collision c)
    {
        if (c.transform.name == "Learth(Clone)")
        {
            //sound
            Manager.points += Manager.BOOST_POINTS;
            Manager.Popup(5, "" + Manager.BOOST_POINTS, this.transform.position);
            //increment boost counter in manager
            Manager.boost_count++;
            GameObject      go    = GameObject.Find("Alien_Exp_Sound");
            Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();
            ascpt.boost_2.Play();

            is_activated = true;
            start_time   = Time.time;

            //make gameobject too small to hit while script is running (then it gets destoryed)
            transform.localScale -= transform.localScale;
        }
    }
예제 #6
0
    void DoJump()
    {
        GameObject      go    = GameObject.Find("Alien_Exp_Sound");
        Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();

        ascpt.jump.Play();

        //explosion
        Instantiate(manager.space_jump_effect, Manager.l.transform.position, Manager.l.transform.rotation);

        //	Debug.Break();
        Vector3 jump = Learth_Movement.velocity * dist_count;

        Manager.l.transform.position = new Vector3(Manager.l.transform.position.x + jump.x,
                                                   Manager.l.transform.position.y + jump.y, Manager.l.transform.position.z + jump.z);

        Learth_Movement.lastPos.transform.position += jump;
        ascpt.jump.Play();
        Instantiate(manager.space_jump_effect, Manager.l.transform.position, Manager.l.transform.rotation);
        gscpt.jump_ammo--;
        dist_count = 50;
    }
예제 #7
0
    void OnCollisionEnter(Collision collision)
    {
        //if learth collides with a space rip, die
        if (collision.gameObject.name == "Space_Rip(Clone)")
        {
            if (!Manager.IS_INVINCIBLE)
            {
                Manager.energy -= Manager.SPACE_RIP_COST;
            }
        }
        //if learth collides with a star, die
        if (collision.gameObject.name == "Star(Clone)")
        {
            Starscript scpt = collision.gameObject.GetComponent <Starscript>();


            //end level if reach sink

            /*
             *
             * PREVIOUS VERSION END CONDITION
             *
             *
             * if (scpt.is_sink) {
             *              //record delivered energy
             *              Manager.gscpt.energy_delivered = Manager.energy;
             *              //increment level counter
             *              Manager.gscpt.cur_level++;
             *              //set in game to false
             *              Manager.gscpt.in_game = false;
             *              //open the ship outfitter
             *              Application.LoadLevel("Ship_Outfitter");
             *      } */


            //if the invincibility powerup is turned on, instead of dying, blow the star up and steal its energy


            /* else */ if (Manager.IS_INVINCIBLE && !scpt.isBlackHole)
            {
                Manager.Popup(5, "" + Manager.INVINC_ENERGY_BONUS, this.transform.position);
                Manager.points += Manager.INVINC_ENERGY_BONUS;
                Starscript col_scpt = collision.gameObject.GetComponent <Starscript>();
                col_scpt.removeStar(2);
            }
            else if (!scpt.spiral)
            {
                //effect
                Instantiate(reset_effect, Manager.l.transform.position, Manager.l.transform.rotation);
                Manager.Die();
            }
        }

        if (collision.gameObject.name == "Wall(Clone)")
        {
            WallScript script = collision.gameObject.GetComponent <WallScript>();
            if (Manager.IS_INVINCIBLE && script.visible)
            {
                Instantiate(explosion, transform.position, transform.rotation);
                Destroy(collision.gameObject);
                wall_down = true;
            }
            else
            {
                //effect
                Instantiate(reset_effect, Manager.l.transform.position, Manager.l.transform.rotation);

                //bounce ship off wall - v' = 2 * (v . n) * n - v
                Vector3 v         = Vector3.Normalize(velocity);
                Vector3 n         = last_norm;                 //normal of the plane we're about to hit
                float   dp        = Vector3.Dot(v, n);
                Vector3 v2        = 2 * dp * n;
                Vector3 reflected = -1 * (v2 - v);
                lastPos.position = transform.position - reflected;
            }
        }

        if (collision.gameObject.name == "coin(Clone)")
        {
            GameObject      go    = GameObject.Find("Alien_Exp_Sound");
            Alien_Exp_Sound ascpt = go.GetComponent <Alien_Exp_Sound>();
            ascpt.coin_grab.Play();
            gscpt.coins_collected++;
            Manager.energy += 3;
            Manager.Popup(3, "" + Manager.COIN_POINTS, this.transform.position);
            Manager.points += Manager.COIN_POINTS;
            cpe             = Instantiate(coin_pickup_effect, collision.gameObject.transform.position,
                                          collision.gameObject.transform.rotation) as GameObject;
            Destroy(collision.gameObject);
        }
    }