Ejemplo n.º 1
0
    void Start()
    {
        //Initializing the player's items
        itemManager = gameObject.AddComponent<ItemManager>();
        GameObject soap = Resources.Load("soap") as GameObject;
        GameObject chlorine = Resources.Load("chlorineDrop") as GameObject;
        itemManager.AddItem(soap.GetComponent<Item>(), 10);
        itemManager.AddItem(chlorine.GetComponent<Item>(), 10);

        itemManager.DisplayCurrentItem(); //showing the first item on screen

        isWearingSandals = false; //telling the game that the player doesn't have sandals yet

        health = originalHealth; //setting current health to the base health

        //if we are in the main game, show the player on screen
        if (Application.loadedLevelName == "mainGame")
        {
            playerInstance =
                Instantiate
                    (
                        Resources.Load("Player") as GameObject,
                        Vector2.zero,
                        Quaternion.identity
                    ) as GameObject;
            playerInstanceSpriteRenderer = playerInstance.GetComponent<SpriteRenderer>();
        }

        //show the initial score and health
        GameController.UpdateScoreText();
        GameController.UpdateHealthText();
    }