Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        // Initialize boss.
        boss               = new Boss();
        bossFlasher        = bossImageObj.GetComponent <ColorFlasher>();
        bossHpBar          = bossHpBarObj.GetComponent <ScalingBar>();
        bossHpBar.maxValue = boss.hp;
        bossHpBar.curValue = boss.hp;

        // Initialize characters.
        characters = new List <Character>();
        characters.Add(new Character().setMaxHp(150));         // Warrior gets more hp
        characters.Add(new Character().setMovespeed(400f));    // Thief moves faster
        characters.Add(new Character());
        currentCharacterHpBar          = thiefHpBarObj.GetComponent <ScalingBar>();
        currentCharacterHpBar.maxValue = characters[1].hp;
        currentCharacterHpBar.curValue = characters[1].hp;
        currentCharacterHpBar          = mageHpBarObj.GetComponent <ScalingBar>();
        currentCharacterHpBar.maxValue = characters[2].hp;
        currentCharacterHpBar.curValue = characters[2].hp;
        currentCharacterHpBar          = warriorHpBarObj.GetComponent <ScalingBar>();
        currentCharacterHpBar.maxValue = characters[0].hp;
        currentCharacterHpBar.curValue = characters[0].hp;


        randSpawner = randomSpawnerObj.GetComponent <RandomSpawner>();

        // Initialize GUI things.
        attackButtonPosition  = attackButton.GetComponent <RectTransform>().anchoredPosition;
        itemButtonPosition    = itemButton.GetComponent <RectTransform>().anchoredPosition;
        magicButtonPosition   = magicButton.GetComponent <RectTransform>().anchoredPosition;
        warriorPanelPosition  = warriorPanel.GetComponent <RectTransform>().anchoredPosition;
        thiefPanelPosition    = thiefPanel.GetComponent <RectTransform>().anchoredPosition;
        magePanelPosition     = magePanel.GetComponent <RectTransform>().anchoredPosition;
        commandSelectorRect   = commandSelector.GetComponent <RectTransform>();
        characterSelectorRect = characterSelector.GetComponent <RectTransform>();
        turnBar          = turnBarObj.GetComponent <ScalingBar>();
        turnBar.maxValue = turnDuration;
        turnBar.curValue = 0;
        turnBarFlasher   = turnBarHighlightObj.GetComponent <ColorFlasher>();

        soundController = soundObj.GetComponent <SoundController>();

        pointer = FindObjectOfType <PointerController>();
        pointer.setCharacter(currentCharacter);
    }
Esempio n. 2
0
    /// Changes character and starts the next turn.
    private void changeCharacter(CHARACTER_TYPE character)
    {
        characterDied = false;
        pointer.start();
        currentCharacter = character;
        pointer.setCharacter(character);
        switch (character)
        {
        case CHARACTER_TYPE.WARRIOR:
            currentCharacterHpBar = warriorHpBarObj.GetComponent <ScalingBar>();
            break;

        case CHARACTER_TYPE.THIEF:
            currentCharacterHpBar = thiefHpBarObj.GetComponent <ScalingBar>();
            break;

        case CHARACTER_TYPE.MAGE:
            currentCharacterHpBar = mageHpBarObj.GetComponent <ScalingBar>();
            break;
        }
        pointer.speed = characters[(int)currentCharacter].getMovespeed();
        turnReset();
    }