protected override void _StartGame()
    {
        base._StartGame();

        for (int i = 0; i < Settings.won_with_which_weapons.Length; i++)
        {
            if (Settings.won_with_which_weapons[i])
            {
                GarageController.UnlockWeapon(i);
            }
        }
    }
Example #2
0
 protected virtual void _StartGame()
 {
     GarageController.UnlockWeapon(0);
 }
Example #3
0
    public IEnumerator End()
    {
        bool victory = true;

        if (!Input.GetKey(KeyCode.C))
        {
            for (int i = 0; i < Map.m.tower_fabs.Length + 1; i++)
            {
                if (Map.m.sectors[i].color != Sector.BlockColor.Cyan)
                {
                    victory = false;
                    break;
                }
            }
        }

        AsyncOperation o = null;

        if (!victory)
        {
            o = Application.LoadLevelAsync("scene_garage");
            o.allowSceneActivation = false;
        }

        GameObject p = Chassis.c.gameObject;

        while (p.transform.position.z > -200f)
        {
            p.transform.position += new Vector3(0f, 0f, -100f * Time.deltaTime);
            aud.volume           -= Time.deltaTime * 0.5f;
            yield return(null);
        }

        // Do clean up or anything else HERE

        // Unlocked a weapon!?
        if (GarageController.selected_sector.weapon_unlock >= 0)
        {
            GarageController.UnlockWeapon(GarageController.selected_sector.weapon_unlock);
        }

        // Won with a new weapon!?
        bool save_settings = false;

        for (int i = 0; i < GarageController.weapons.Length; i++)
        {
            if ((Chassis.c.sc_class_1 && Chassis.c.fore != null &&
                 Chassis.c.fore.weapon_name.Equals(GarageController.weapons[i].weapon_name))
                ||
                (Chassis.c.sc_class_2 && Chassis.c.turret != null &&
                 Chassis.c.turret.weapon_name.Equals(GarageController.weapons[i].weapon_name)))
            {
                Settings.won_with_which_weapons[i] = true;

                bool unlocked_jack_achieve = true;
                for (int j = 0; j < Settings.won_with_which_weapons.Length; j++)
                {
                    if (!Settings.won_with_which_weapons[j])
                    {
                        unlocked_jack_achieve = false;
                        j = Settings.won_with_which_weapons.Length;
                    }
                }
                if (unlocked_jack_achieve)
                {
                    Utilities.u.UnlockAchievement("Jack of All Guns");
                }
                save_settings = true;
            }
        }

        if (save_settings)
        {
            Settings.SaveSettings();
        }
        // Okay clean up is all done.

        if (!victory)
        {
            o.allowSceneActivation = true;
            while (!o.isDone)
            {
                yield return(true);
            }

            p.transform.position = Vector3.zero;
            p.transform.rotation = Quaternion.identity;
        }
        else
        {
            //Achievement
            Utilities.u.UnlockAchievement("Golden Chariot");

            Destroy(Chassis.c.gameObject);
            Destroy(Map.m);

            Application.LoadLevelAsync("scene_victory");
        }

        Destroy(gameObject);
    }