public int consume_Food;              //food consume

    public void Awake()
    {
        the_Location_Info    = FindObjectOfType <LocationInfo>();
        the_Stats_UI         = FindObjectOfType <StatsUI>();
        the_Food_Consumption = FoodConsumption.Medium;
        the_Car_Speed        = CarSpeed.Normal;
    }
Esempio n. 2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 3
0
    public void PlayerAddGem()
    {
        statsUi = FindObjectOfType <StatsUI>(); //call it once again cause game object is from previus scenne
        player.AddGem();

        PlayerPrefs.SetInt("Player_gems", player.gems);
        statsUi.RefreshTexts(player.coins, player.gems, player.deaths);
    }
Esempio n. 4
0
 void Start()
 {
     gameManager  = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
     yearlyEvents = GameObject.FindGameObjectWithTag("GameManager").GetComponent <YearlyEvents>();
     cameraMove   = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMove>();
     statsUI      = GetComponent <StatsUI>();
     resourceUI   = GetComponent <ResourceUI>();
 }
Esempio n. 5
0
 private void FindObjects()
 {
     player      = GameObject.Find("Player").GetComponent <PlayerManager>();
     BuffManager = player.GetComponentInParent <PlayerBuffManager>();
     EnemyArea   = GameObject.Find("EnemyPlayArea").GetComponent <EnemyPlayArea>();
     cardTracker = GameObject.Find("GameTestManager").GetComponent <GameCardTracker>();
     gameStats   = GameObject.Find("GameStatsUI").GetComponent <StatsUI>();
     gameManager = GameObject.Find("GameTestManager").GetComponent <GameTestManager>();
 }
Esempio n. 6
0
 private void Awake()
 {
     if (Instance != null)
     {
         Debug.LogError("More than one instance of StatsUI found!");
         return;
     }
     Instance = this;
 }
        public override void Initialize()
        {
            drag = false;

            // Set grid values
            gridWidth    = Globals.GRID_WIDTH;
            gridHeight   = 3;
            gridLocation = new Point(Globals.GridLocation.X, Globals.GridLocation.Y + Globals.TILE_HEIGHT * 5);

            // Set sprites/textures
            background = ArtAssets.backgroundGrassLevel;

            // UI
            statsUI                  = new StatsUI();
            Globals.statsUI          = statsUI;
            Globals.statsUI.Diamonds = Globals.diamonds;

            armyShowCase          = ArtAssets.ArmyShowCase;
            armyShowCase.position = ArmyShowCasePosition;

            // Set buttons
            buttons.Add(new Button(ArtAssets.StartButton, StartButtonPosition));
            buttons[0].ClickEvent += Ready;

            buttons.Add(new Button(ArtAssets.HomeButton, HomeButtonPosition));
            buttons[1].ClickEvent += Quit;

            Armies.army = new List <Character>();
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Leader).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.General).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.General).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Captain).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Captain).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Soldier).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Soldier).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Miner).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Bomb).Clone());
            Armies.army.Add(Armies.GetCharacter(Character.Rank.Bomb).Clone());

            Armies.army[0].position = Grid.ToPixelLocation(new Point(0, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[1].position = Grid.ToPixelLocation(new Point(1, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[2].position = Grid.ToPixelLocation(new Point(2, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[3].position = Grid.ToPixelLocation(new Point(3, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[4].position = Grid.ToPixelLocation(new Point(4, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[5].position = Grid.ToPixelLocation(new Point(5, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[6].position = Grid.ToPixelLocation(new Point(6, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[7].position = Grid.ToPixelLocation(new Point(7, 0), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[8].position = Grid.ToPixelLocation(new Point(0, 1), gridLocation, Globals.TileDimensions).ToVector2();
            Armies.army[9].position = Grid.ToPixelLocation(new Point(1, 1), gridLocation, Globals.TileDimensions).ToVector2();

            SelectCharacter(Armies.army[0]);

            armyName          = ArtAssets.ArmyNames;
            armyName.position = RankNamePosition;
            SetArmyDictionary(Character.Army.Normal);
        }
Esempio n. 8
0
 // Start is called before the first frame update
 void Start()
 {
     mouseActive   = false;
     hasRespawned  = false;
     killCount     = 0;
     playerXp      = GetComponent <CharacterExperience>();
     statsUI       = StatsUI.instance;
     currentHealth = getMaxHealth();
     healthBar.SetMaxHealth(getMaxHealth());
     xpBar.SetXp(playerXp.xp);
 }
Esempio n. 9
0
 void Start()
 {
     instance = this;
     messageHandler = GameMessageHandler.Instance;
     messageHandler.Register(this, "GmStats");
     InvokeRepeating("SendRequest", 1f, 5f);
     container = transform.Find("stats").gameObject;
     template = transform.Find("template").gameObject;
     template.SetActive(false);
     canvas = gameObject.GetComponent<Canvas>() as Canvas;
     canvas.enabled = false;
 }
Esempio n. 10
0
    // Start is called before the first frame update
    void Start()
    {
        // Instantiate the boolean values
        attack       = false;
        mouseActive  = false;
        hasRespawned = false;

        // Set up health bar and XP bar
        killCount     = 0;
        playerXp      = GetComponent <CharacterExperience>();
        statsUI       = StatsUI.instance;
        currentHealth = getMaxHealth();
        healthBar.SetMaxHealth(getMaxHealth());
        xpBar.SetXp(playerXp.xp);
    }
Esempio n. 11
0
        public override void Initialize()
        {
            statsUI = Globals.statsUI;

            buttons.Add(new Button(ArtAssets.EndTurnButton, EndTurnButtonPosition));
            buttons[0].ClickEvent = EndTurn;

            buttons.Add(new Button(ArtAssets.HomeButton, HomeButtonPosition));
            buttons[1].ClickEvent = QuitMatch;

            SetMovable();

            Globals.multiplayerConnection.ReceiveMove    += ReceivedMove;
            Globals.multiplayerConnection.ReceiveFight   += ReceivedFight;
            Globals.multiplayerConnection.ReceiveEndTurn += OtherPlayerEndedHisTurn;

            Globals.earnedDiamonds = 0;
        }
Esempio n. 12
0
    public StatsData()
    {
        GameObject statsUI     = GameObject.Find("Stats UI");
        StatsUI    statsScript = statsUI.GetComponent <StatsUI>();

        if (statsUI != null && statsScript != null)
        {
            Debug.Log("StatsData: Przypisano statystyki");

            levelValue    = statsScript.levelValue;
            strengthValue = statsScript.strengthValue;
            attackValue   = statsScript.attackValue;
            Debug.Log("StatsData: statystyki: " + levelValue + "\n" + strengthValue + "   " + attackValue);
        }
        else if (statsUI == null || statsScript == null)
        {
            Debug.Log("StatsData: Nie przypisano statystyk");
        }
    }
    private StatsUI SpawnOrRecycleStatsUI()
    {
        StatsUI statsUIToReturn = null;

        foreach (StatsUI ui in listGarbageStatsUI)
        {
            if (!ui.isActiveAndEnabled)
            {
                statsUIToReturn = ui;
            }
        }

        if (statsUIToReturn == null)
        {
            GameObject inst = Instantiate(prefabStatsUI.gameObject, prefabStatsUI.transform.parent) as GameObject;
            statsUIToReturn = inst.GetComponent <StatsUI>();
            statsUIToReturn.transform.SetSiblingIndex(1);

            listGarbageStatsUI.Add(statsUIToReturn);
        }

        return(statsUIToReturn);
    }
Esempio n. 14
0
    //set all the reference scripts
    private void SetScripts()
    {
        GameObject scriptHolder = GameObject.Find("ScriptHolder");
        int        currentScene = SceneManager.GetActiveScene().buildIndex;

        if (currentScene == 1)
        {
            userTools          = scriptHolder.GetComponent <UserTools>();
            itemTools          = scriptHolder.GetComponent <ItemTools>();
            tempGetDefaultItem = scriptHolder.GetComponent <TempGetDefaultItem>();
            selectedItemScript = scriptHolder.GetComponent <SelectedItemScript>();
            afkTimeScript      = scriptHolder.GetComponent <AfkTimeScript>();
            playTimeScript     = scriptHolder.GetComponent <PlayTimeScript>();
            statsUI            = scriptHolder.GetComponent <StatsUI>();
            customiseUserUI    = scriptHolder.GetComponent <CustomiseUserUI>();
            shopItemsManager   = scriptHolder.GetComponent <ShopItemsManager>();
            leftItemManager    = scriptHolder.GetComponent <LeftItemManager>();
            playerUI           = scriptHolder.GetComponent <PlayerUI>();
        }
        else if (currentScene == 2)
        {
        }
    }
Esempio n. 15
0
    void Start()
    {
        if (DataHandler.hasLoadedFile() && !Menu.newGame)
        {
            DataHandler.load(this);
        }
        else
        {
            warStatus.Add(Kingdom.Cobeth, false);
            warStatus.Add(Kingdom.Jalonn, false);
            warStatus.Add(Kingdom.Galerd, false);
            warStatus.Add(Kingdom.Rym, false);

            conqueredStatus.Add(Kingdom.Cobeth, false);
            conqueredStatus.Add(Kingdom.Jalonn, false);
            conqueredStatus.Add(Kingdom.Galerd, false);
            conqueredStatus.Add(Kingdom.Rym, false);
        }

        allGoods.Add(rymGoodPrices);
        allGoods.Add(jalonnGoodPrices);
        allGoods.Add(galerdGoodPrices);
        allGoods.Add(cobethGoodPrices);

        tradeObjects.Add(cobethTrade);
        tradeObjects.Add(jalonnTrade);
        tradeObjects.Add(rymTrade);
        tradeObjects.Add(galerdTrade);

        originalTrades  = tradesLeft;
        originalSeconds = secondsBetweenYears;
        statsUI         = canvas.GetComponent <StatsUI>();
        resourceUI      = canvas.GetComponent <ResourceUI>();
        cameraMove      = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMove>();

        generateGoodPrices();
    }
Esempio n. 16
0
    public void LoadPlayer()
    {
        PlayerData data = SaveSystem.LoadPlayer();

        Vector3 position;

        position.x = data.position[0];
        position.y = data.position[1];
        position.z = data.position[2];

        GameObject statsUI     = GameObject.Find("Stats UI");
        StatsUI    statsScript = statsUI.GetComponent <StatsUI>();

        float levelValue    = data.stats.levelValue;
        float strengthValue = data.stats.strengthValue;
        float attackValue   = data.stats.attackValue;

        if (player != null && statsUI != null && statsScript != null)
        {
            player.transform.position = position;

            statsScript.levelValue    = levelValue;
            statsScript.strengthValue = strengthValue;
            statsScript.attackValue   = attackValue;

            statsScript.level.text    = "Level " + levelValue.ToString();
            statsScript.strength.text = "Strength " + strengthValue.ToString();
            statsScript.attack.text   = "Attack " + attackValue.ToString();

            Debug.Log("MenuUI: Przycisk wczytu gry wykonał operację");
        }
        else if (player == null && statsUI == null || statsScript == null)
        {
            Debug.Log("MenuUI: Przycisk wczytu gry nie wykonał operacji");
        }
    }
Esempio n. 17
0
 void Awake()
 {
     StatsScript = gameObject.AddComponent <StatsUI>();
 }
    // Use this for initialization
    void Start () {
        ui = GameObject.Find("UIStats").GetComponent<StatsUI>();
        Health = initHealth;

	}
Esempio n. 19
0
 private void Start()
 {
     Instance = this;
 }
Esempio n. 20
0
 public UIController(WorldSimulator worldSimulator, TimeController timeController, StatsUI statsUI)
 {
     _simulator = worldSimulator;
     _time      = timeController;
     _statsUI   = statsUI;
 }