예제 #1
0
파일: Wall.cs 프로젝트: AdrienMarcenat/LD42
    public override void Init(ETileObjectType type, int x, int y, string[] args)
    {
        base.Init(type, x, y, args);
        EFacingDirection wallOrientation = (EFacingDirection)Enum.Parse(typeof(EFacingDirection), (String)args.GetValue(0), true);

        GetComponent <SpriteRenderer> ().sprite = RessourceManager.LoadSprite(args[1], 0);
        transform.rotation = Quaternion.Euler(new Vector3(0, 0, PlayerController.ms_FacingAngles[wallOrientation]));
    }
예제 #2
0
파일: Bin.cs 프로젝트: AdrienMarcenat/LD42
    public override void Init(ETileObjectType type, int x, int y, string[] args)
    {
        base.Init(type, x, y, args);
        m_Number = Int32.Parse((String)args.GetValue(0));
        GameObject numberObject = GameObject.Instantiate(RessourceManager.LoadPrefab("number"));

        numberObject.transform.SetParent(transform, false);
        numberObject.GetComponent <SpriteRenderer> ().sprite = RessourceManager.LoadSprite("number-" + (m_Number + 1), 0);
        GoalManagerProxy.Get().RegisterBin(this);
    }
예제 #3
0
    IEnumerator Init(List <ECharacterClass> enemies)
    {
        yield return(null);

        m_CurrentIndex     = 0;
        m_ShoudDoEnemyTurn = false;
        m_IsEnemyTurn      = false;
        m_IsApplyingAction = false;
        m_Team             = new List <Character> ();
        m_Healths          = new Dictionary <Character, Image> ();
        m_Animators        = new Dictionary <Character, Animator> ();
        int index = 0;

        foreach (CharacterModel model in TeamManagerProxy.Get().GetSortedTeam())
        {
            m_Team.Add(new Character(model));
            m_PlayerThumbnails[index].gameObject.SetActive(true);
            m_PlayerThumbnails[index].sprite = RessourceManager.LoadSprite("Models/" + model.GetClass().ToString(), 0);
            m_Animators.Add(m_Team[index], m_PlayerThumbnails[index].GetComponent <Animator>());
            m_Healths.Add(m_Team[index], m_PlayerThumbnails[index].transform.Find("Health").GetComponent <Image> ());
            index++;
        }
        for (int i = index; i < m_PlayerThumbnails.Count; ++i)
        {
            m_PlayerThumbnails[i].gameObject.SetActive(false);
        }
        m_CurrentPlayer = m_Team[0];
        ActivateButtons(true);

        m_Enemies = new List <Character> ();
        index     = 0;
        foreach (ECharacterClass characterClass in enemies)
        {
            m_Enemies.Add(new Character(new CharacterModel("Enemy", characterClass)));
            m_EnemiesThumbnails[index].gameObject.SetActive(true);
            m_EnemiesThumbnails[index].sprite = RessourceManager.LoadSprite("Models/" + characterClass.ToString(), 0);
            m_Animators.Add(m_Enemies[index], m_EnemiesThumbnails[index].GetComponent <Animator> ());
            m_Healths.Add(m_Enemies[index], m_EnemiesThumbnails[index].transform.Find("Health").GetComponent <Image> ());
            index++;
        }
        for (int i = index; i < m_EnemiesThumbnails.Count; ++i)
        {
            m_EnemiesThumbnails[i].gameObject.SetActive(false);
        }
        BattleManagerProxy.Get().Init(m_Team, m_Enemies);
        m_IsInBattle = true;
        UpdateUI();
    }
예제 #4
0
    private void UpdateUI()
    {
        m_Models = new List <CharacterModel> ();
        int index = 0;

        foreach (CharacterModel model in TeamManagerProxy.Get().GetSortedTeam())
        {
            m_Models.Add(model);
            m_Players[index].SetActive(true);
            m_Players[index].GetComponentInChildren <Image>().sprite = RessourceManager.LoadSprite("Models/" + model.GetClass().ToString(), 0);
            index++;
        }
        for (int i = index; i < m_Players.Count; ++i)
        {
            m_Players[i].SetActive(false);
        }
    }
예제 #5
0
    public void DisplayNextSentence()
    {
        if (m_Sentences.Count == 0)
        {
            EndDialogue();
            return;
        }
        StopAllCoroutines();
        Dialogue.ITextInterface sentence = m_Sentences.Dequeue();
        string speakerName = sentence.GetName();

        if (speakerName == "Choice")
        {
            m_IsWaitingChoice  = true;
            m_DialogeText.text = "";
            Dialogue.Choice choice = (Dialogue.Choice)sentence;
            Assert.IsTrue(choice.m_Choices.Count <= m_ChoicesButton.Count);

            for (int i = 0; i < choice.m_Choices.Count; ++i)
            {
                KeyValuePair <string, string> pair = choice.m_Choices[i];
                Button button = m_ChoicesButton[i];
                button.gameObject.SetActive(true);
                button.GetComponentInChildren <Text> ().text = pair.Key;
                button.onClick.AddListener(delegate
                {
                    m_IsWaitingChoice = false;
                    Dialogue d        = FindSubdialogue(pair.Value);
                    if (d != null)
                    {
                        StartDialogue(d);
                    }
                });
            }
        }
        else
        {
            if (m_NameText.text != speakerName)
            {
                m_NameText.text    = speakerName;
                m_Thumbnail.sprite = RessourceManager.LoadSprite("Models/" + m_SpeakerClass[speakerName].ToString(), 0);
            }
            StartCoroutine(TypeSentence(sentence.GetText()));
        }
    }
예제 #6
0
    public void DisplayNextSentence()
    {
        if (m_Sentences.Count == 0)
        {
            EndDialogue();
            return;
        }
        StopAllCoroutines();
        Dialogue.Sentence sentence    = m_Sentences.Dequeue();
        string            speakerName = sentence.m_Name;

        if (m_NameText.text != speakerName)
        {
            m_NameText.text    = speakerName;
            m_Thumbnail.sprite = RessourceManager.LoadSprite(speakerName, 0);
        }
        StartCoroutine(TypeSentence(sentence.m_Sentence));
    }