示例#1
0
    // Use this for initialization
    void Start()
    {
        playerSaveLoadMethods = new PlayerSaveLoadMethods();
        gameObject.GetComponent<PlayerControler>().enabled = false;
        gameObject.GetComponent<PlayerControllerTest>().enabled = true;

        cameraRod = GameObject.Find ("Player2/cameraRod");
        MainCamera = GameObject.Find("Player2/MainCamera");

        cameraRod.SetActive (false);
        MainCamera.SetActive (true);

        //Initialize the resource record
        //Index – ResouceName
        //1 – Aluminum
        //2 – Copper
        //3 – Diamond
        //4 – Gold
        //		5 – Hydrogen
        //		6 – Iron
        //		7 – Lead
        //		8 – Platinum
        //		9 – Unobtanium
        //		10- Uranium
        //		0 – Asteroid
        resources = new int[11] {0, 0, 0, 0,
            0, 0, 0, 0,
            0, 0, 0};
        //Load the resources in the player prefs, do not reset to zero
        string resourcesText = playerSaveLoadMethods.loadThePlayerResources();
        string[] tempListResources = resourcesText.Split(',');
        for(int i = 0; i < resources.Length; i++){
            resources[i] = int.Parse(tempListResources[i]);
        }

        //Initialize the player health
        //PlayerHealth = 10f;
        //Reese changed this, this will load whatever is in the playerprefs
        PlayerHealth = (float)PlayerPrefs.GetInt("health");

        listShipUpgradesPurchased = new ArrayList();
        listHomeBaseUpgrades = new ArrayList();

        // Initialize upgrades
        numBlasters = 0;
        blasterPower = 0;
        missilePower = 0;
        hullStrength = 0;
        hullRegen = 0;
        shieldPower = 0;
        movementLevel = 0;
        radarLevel = 0;
        resourceMagnet = 0;

        counter = 750;
    }
示例#2
0
文件: UI.cs 项目: tzfyb/DeepSpaceMine
    // Use this for initialization
    void Start()
    {
        playerSaveLoadMethods = new PlayerSaveLoadMethods ();
                listOfBaseUpgradeObjects = new ArrayList ();
                //Load the icons for the resource layout
                ironIcon = Resources.Load ("UITextures/ironIcon", typeof(Texture2D)) as Texture2D;
                copperIcon = Resources.Load ("UITextures/copperIcon", typeof(Texture2D)) as Texture2D;
                alumIcon = Resources.Load ("UITextures/alumIcon", typeof(Texture2D)) as Texture2D;
                diamondIcon = Resources.Load ("UITextures/diamondIcon", typeof(Texture2D)) as Texture2D;
                uranIcon = Resources.Load ("UITextures/uranIcon", typeof(Texture2D)) as Texture2D;
                hydrogenIcon = Resources.Load ("UITextures/hydrogenIcon", typeof(Texture2D)) as Texture2D;
                platIcon = Resources.Load ("UITextures/platIcon", typeof(Texture2D)) as Texture2D;
                leadIcon = Resources.Load ("UITextures/leadIcon", typeof(Texture2D)) as Texture2D;
                goldIcon = Resources.Load ("UITextures/goldIcon", typeof(Texture2D)) as Texture2D;
                unobtainIcon = Resources.Load ("UITextures/unobtainIcon", typeof(Texture2D)) as Texture2D;
                asteroidIcon = Resources.Load ("UITextures/asteroidIcon", typeof(Texture2D)) as Texture2D;

                //Load the player health bar texture
                playerHealthbar = Resources.Load ("UITextures/playerHealthBar", typeof(Texture2D)) as Texture2D;

                //The style for the main title
                boxGUIStyle = new GUIStyle ();
                boxGUIStyle.fontSize = 14;
                boxGUIStyle.normal.textColor = Color.white;

                //tierOneColumnXPos = (40 * 1);
                //tierTwoColumnXPos = (40 * 4);
                //tierThreeColumnXPos = (40 * 7);
                //tierFourColumnXPos = (40 * 10);

                tierOneRightColumnXPos = screenWidth - (defaultButtonWidth * 1);
                tierTwoRightColumnXPos = screenWidth - (defaultButtonWidth * 2);
                tierThreeRightColumnXPos = screenWidth - (defaultButtonWidth * 3);
                tierFourRightColumnXPos = screenWidth - (defaultButtonWidth * 4);

                buttonCenterPosX = (screenWidth / 2) - (defaultButtonWidth / 2);
                rightBoxPosX = screenWidth - (defaultButtonWidth * 3);
                isHealthScaleRemovalValueSet = false;
                //Add the upgrades
                //Tier 1
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (1, "Auto Turret", (costScale * 8), 0, 0, 0, 0, (costScale * 2), 0, 0, 0, 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (1, "Shell", (costScale * 8), 0, 0, 0, 0, (costScale * 2), 0, 0, 0, 0, false));
                //Tier 2
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (2, "Auto Turret", (costScale * 4), 0, 0, 0, 0, (costScale * 2), (costScale * 2), (costScale * 2), 0, 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (2, "Shell", 0, 0, 0, 0, 0, (costScale * 4), 0, (costScale * 3), (costScale * 2), 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (2, "Shield", 0, (costScale * 5), (costScale * 1), 0, 0, 0, 0, 0, (costScale * 4), 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (2, "Missile Battery", (costScale * 2), 0, (costScale * 3), 0, 0, (costScale * 3), 0, (costScale * 1), (costScale * 1), 0, false));
                //Tier 3
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (3, "Auto Turret", (costScale * 1), 0, 0, (costScale * 3), 0, (costScale * 2), (costScale * 3), (costScale * 1), 0, 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (3, "Shell", 0, 0, 0, (costScale * 6), 0, 0, 0, (costScale * 2), (costScale * 2), 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (3, "Shield", 0, (costScale * 1), (costScale * 1), (costScale * 4), (costScale * 1), 0, 0, (costScale * 2), (costScale * 1), 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (3, "Missile Battery", (costScale * 1), (costScale * 1), 0, (costScale * 2), (costScale * 1), (costScale * 2), (costScale * 2), (costScale * 1), 0, 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (3, "Nuclear Weapons", 0, 0, 0, (costScale * 4), (costScale * 3), (costScale * 1), 0, (costScale * 1), 0, 0, false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (3, "Mine Field", 0, (costScale * 1), (costScale * 2), (costScale * 3), (costScale * 1), 0, (costScale * 2), (costScale * 1), 0, 0, false));
                //Tier 4
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Auto Turret", 0, 0, 0, (costScale * 2), 0, (costScale * 1), (costScale * 2), (costScale * 1), 0, (costScale * 4), false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Shell", 0, 0, 0, (costScale * 1), 0, 0, 0, (costScale * 1), (costScale * 1), (costScale * 7), false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Shield", 0, 0, 0, (costScale * 3), (costScale * 1), 0, 0, (costScale * 2), 0, (costScale * 4), false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Missile Battery", 0, 0, 0, (costScale * 2), (costScale * 1), (costScale * 2), 0, (costScale * 1), 0, (costScale * 3), false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Nuclear Weapons", 0, 0, 0, (costScale * 3), (costScale * 3), (costScale * 1), 0, (costScale * 1), 0, (costScale * 2), false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Mine Field", 0, 0, 0, (costScale * 3), (costScale * 1), 0, 0, (costScale * 1), 0, (costScale * 5), false));
                listOfBaseUpgradeObjects.Add (new BaseUpgradeObject (4, "Orbiting Platform", 0, (costScale * 2), (costScale * 1), 0, 0, 0, 0, (costScale * 1), 0, (costScale * 5), false));
                if(Application.loadedLevelName.Equals("main"))
                {
                    levelName = "HomeBase";
                }else if(Application.loadedLevelName.Equals("HomeBase"))
                {
                    levelName = "main";
                }
    }