Exemple #1
0
 void Start()
 {
     _gameManager    = GameObject.Find("Game manager").GetComponent <Game_manager>();
     _combatManager  = GameObject.Find("Game manager").GetComponent <Combat_manager_script>();
     _notification   = GameObject.Find("Notification").GetComponent <Ingame_notification_script>();
     _characterStats = GameObject.Find("Game manager").GetComponent <Character_stats>();
     _spellScript    = GameObject.Find("Game manager").GetComponent <Spell_script>();
 }
    public static void saveSpells(Spell_script spellScript)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/spells.save";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        SpellData data = new SpellData(spellScript);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemple #3
0
    void Start()
    {
        _spellScript     = GameObject.Find("Game manager").GetComponent <Spell_script>();
        _characterStats  = GameObject.Find("Game manager").GetComponent <Character_stats>();
        _spellSlotSelect = GameObject.Find("Spell_slot_select").GetComponent <Spell_slot_select_script>();
        spell_id         = GameObject.Find("Game manager").GetComponent <Character_stats>().Talents[ID];

        spell_icon.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(_spellScript.spells[spell_id].icon);


        spell_points_text.GetComponent <Text_animation>().startAnim(_spellScript.spells[spell_id].current_spell_points + "/" + _spellScript.spells[spell_id].max_spell_points, 0.05f);

        if (_spellScript.spells[spell_id].type == spell_types.passive)
        {
            slot.GetComponent <SpriteRenderer>().sprite = passive_spell_normal;
        }
        else
        {
            slot.GetComponent <SpriteRenderer>().sprite = sprite_normal;
        }
    }
    void Start()
    {
        Application.targetFrameRate = 300;

        _characterStats = GameObject.Find("Game manager").GetComponent <Character_stats>();
        _questManager   = gameObject.GetComponent <Quest_manager_script>();
        _spellScript    = gameObject.GetComponent <Spell_script>();

        current_screen = GameObject.Find("Main_screen");

        GameObject.Find("Main_screen").SetActive(true);

        GameObject.Find("Character_customization_screen").SetActive(false);
        GameObject.Find("Character_screen_UI").SetActive(false);
        GameObject.Find("Store_screen_UI").SetActive(false);
        GameObject.Find("Combat_screen_UI").SetActive(false);
        GameObject.Find("Quest_screen_UI").SetActive(false);
        GameObject.Find("Map_screen_UI").SetActive(false);
        GameObject.Find("Spell_screen_UI").SetActive(false);

        navigationBarVisibility();
    }
Exemple #5
0
    public void initializeBattle(int id)
    {
        _characterStats     = GameObject.Find("Game manager").GetComponent <Character_stats>();
        _characterManager   = GameObject.Find("Character").GetComponent <Character_manager>();
        _notification       = GameObject.Find("Notification").GetComponent <Ingame_notification_script>();
        _enemyManagerScript = GameObject.Find("Game manager").GetComponent <Enemy_manager_script>();
        _itemScript         = GameObject.Find("Game manager").GetComponent <Item_script>();
        _spellScript        = GameObject.Find("Game manager").GetComponent <Spell_script>();
        isPaused            = false;

        _spellScript.actualizeSpells();
        _spellScript.setupAttributes();

        _healthBar        = GameObject.Find("Health_bar").GetComponent <Bar_script>();
        _resourceBar      = GameObject.Find("Resource_bar").GetComponent <Bar_script>();
        _spellbarAnimator = GameObject.Find("Spellbar").GetComponent <Animator>();

        GameObject.Find("Item_preview").GetComponent <Animator>().Play("Item_preview_slide_out_anim");
        GameObject.Find("Inventory slots").GetComponent <Animator>().Play("Inventory_slide_out_anim");
        GameObject.Find("Conversation").GetComponent <Conversation_script>().closeConversation();

        _spellScript.target = null;

        StopAllCoroutines();
        isOngoing = true;

        if (gameObject.GetComponent <Game_manager>().current_screen.name == "Combat_screen_UI")
        {
            if (_characterStats.Player_health > _characterStats.Player_max_health || _characterStats.Player_health < 0)
            {
                _characterStats.Player_health = _characterStats.Player_max_health;
                _healthBar.updateHealth();
            }

            if (_characterStats.Player_resource > _characterStats.Player_max_resource || _characterStats.Player_resource < 0)
            {
                _characterStats.Player_resource = _characterStats.Player_max_resource;
                _resourceBar.updateResource();
            }
        }

        battle_id = id;

        _characterStats.Player_health   = _characterStats.Player_max_health;
        _characterStats.Player_resource = _characterStats.Player_max_resource;

        _healthBar.updateHealth();
        _resourceBar.updateResource();
        GameObject.Find("Spell_preview").GetComponent <Visibility_script>().setInvisible();

        remaining_time.GetComponent <Text_animation>().startAnim((round_time).ToString(), 0.05f);

        opponent_ids = battles[id].opponent_ids;

        opponents[0].GetComponent <Enemy_script>().enemyInitialize(battles[id].opponent_ids[0]);
        opponents[1].GetComponent <Enemy_script>().enemyInitialize(battles[id].opponent_ids[1]);

        generateSequence();


        _notification.message("¤" + battles[id].battle_name, 3);

        battle_background.GetComponent <SpriteRenderer>().sprite = battles[id].background;


        round_counter = 0;
        timer         = 0;
        changeRound();
    }
Exemple #6
0
 private void Start()
 {
     _characterStats = GameObject.Find("Game manager").GetComponent <Character_stats>();
     _spellScript    = GameObject.Find("Game manager").GetComponent <Spell_script>();
 }
Exemple #7
0
 public SpellData(Spell_script spellScript)
 {
     spells = spellScript.spells;
 }
 void Start()
 {
     _characterStats = GameObject.Find("Game manager").GetComponent <Character_stats>();
     _spellScript    = GameObject.Find("Game manager").GetComponent <Spell_script>();
     _spellPreview   = GameObject.Find("Spell_preview_talent");
 }