/// <summary>
    /// Initializes this instance.
    /// </summary>
    public void Initialize(CharacterSelectUI charSelectUI, UIScrollItem scrollItem,
                           Character character, bool isUsed, bool isOwned, float ownedCharRotSpeed,
                           float normalCharScale, float focusCharScale,
                           float focusAnimTime, Vector3 focusPos,
                           NewCharWinAnimator newCharWinAnim,
                           Animator newCharAnimReference)
    {
        // Store references to character select classes
        m_charSelectUI = charSelectUI;
        m_scrollItem   = scrollItem;
        m_character    = character;

        SetUsed(isUsed);
        SetOwned(isOwned);
        SetOwnedCharRotSpeed(ownedCharRotSpeed);
        SetCharScale(normalCharScale, focusCharScale);
        SetFocusPos(focusPos);
        SetFocusAnimTime(focusAnimTime);

        m_newCharWinAnim = newCharWinAnim;

        // Store reference to animator to follow for new/unused characters
        m_newCharAnimReference = newCharAnimReference;

        // Store the character's starting transform properties
        m_originalRot  = m_character.transform.localEulerAngles;
        m_originalPosZ = m_character.transform.localPosition.z;

        // Set the initialized flag
        m_isInitialized = true;
    }
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one instance of CharacterSelectUI found!");
         return;
     }
     instance = this;
 }
Example #3
0
    public new void Init(CombatManager CM, CharacterSelectUI combatUI)
    {
        base.Init(CM, combatUI);

        foreach (Character C in enemies)
        {
            if (C.Name == "Trevor")
            {
                trevor = C;
            }
        }
        foreach (Character C in allies)
        {
            if (C.Name == "Trevor")
            {
                trevor = C;
            }
        }
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        Destroy(GameObject.Find("BattleButtonsCanvas"));
        combatObj  = GameObject.Find("CombatManager").GetComponent <CombatManager>();
        CUI        = GameObject.Find("CombatUI").GetComponent <CombatUI> ();
        CUI.CM     = combatObj;
        buttonsUIs = FindObjectsOfType <ButtonsUI> ();
        GameObject.Find("Cursor").GetComponent <CursorManager> ().CM = combatObj;
        GameObject.Find("ConflictCursor").GetComponent <ConflictCursorManager> ().CM = combatObj;
        //Destroy(GameObject.Find ("BattleButtonsCanvas"));

        characters              = FindObjectsOfType <Character> ();
        characterselectUIs      = CharacterSelectUI.FindObjectsOfType <CharacterSelectUI> ();
        temporaryUIIntegrations = TemporaryUIIntegration.FindObjectsOfType <TemporaryUIIntegration> ();
        for (int i = 0; i < buttonsUIs.Length; i++)
        {
            buttonsUIs [i].CM = combatObj;
        }
        Destroy(GameObject.Find("BattleSimulator"));
        Destroy(this);
    }
Example #5
0
 //grabs all relevent UI scripts from children
 void LoadUIRefs()
 {
     _csUI     = transform.GetChild(0).GetComponent <CharacterSelectUI>();
     _gridUI   = transform.GetChild(1).GetComponent <GridSetupUI>();
     _battleUI = transform.GetChild(2).GetComponent <BattleUI>();
 }
Example #6
0
    void Start()
    {
        combatQueue = new Character[6];

        CUI     = GameObject.Find("CombatUI").GetComponent <CombatUI> ();
        tCursor = GameObject.Find("TargetCursors").GetComponent <TargetCursor> ();
        GameObject[] CharUI  = new GameObject[3];
        GameObject[] EnemyUI = new GameObject[3];
        Player       = new Character[3];
        Enemy        = new Character[3];
        playerSelect = new Button [3];
        enemySelect  = new Button [3];

        // his block sets up the the characters and character select buttons
        for (int i = 0; i < 3; i++)
        {
            // set up the Character select buttons
            CharacterSelectUI PlayerSUI = GameObject.Find("Player" + i).GetComponent <CharacterSelectUI> ();
            CharacterSelectUI EnemySUI  = GameObject.Find("Enemy" + i).GetComponent <CharacterSelectUI> ();
            PlayerSUI.Init(this);
            EnemySUI.Init(this);

            // Set up the players
            Player[i] = GameObject.Find("Character" + i).GetComponent <Character>();
            Enemy [i] = GameObject.Find("Character" + (i + 3)).GetComponent <Character> ();
            Player [i].Init(this, PlayerSUI);
            Enemy [i].Init(this, EnemySUI);

            playerSelect [i] = GameObject.Find("Player" + i).GetComponent <Button> ();
            enemySelect [i]  = GameObject.Find("Enemy" + i).GetComponent <Button> ();

            // Set up each character's UI
            CharUI [i] = GameObject.Find("CharacterUI" + i);
            CharUI [i].GetComponent <CharacterUI> ().Init(Player [i]);
            EnemyUI [i] = GameObject.Find("CharacterUI" + (i + 3));
            EnemyUI [i].GetComponent <CharacterUI> ().Init(Enemy [i]);

            // Set the character's positions to the buttons
            Player[i].transform.position = new Vector3(playerSelect [i].transform.position.x, playerSelect [i].transform.position.y, 98);
            Enemy [i].transform.position = new Vector3(enemySelect [i].transform.position.x, enemySelect [i].transform.position.y, 98);
        }
        // Get the action buttons and set them up
        Button[] action = new Button[5];
        action [0] = GameObject.Find("ThrowButton").GetComponent <Button> ();
        action [1] = GameObject.Find("CatchButton").GetComponent <Button> ();
        action [2] = GameObject.Find("Skill1Button").GetComponent <Button> ();
        action [3] = GameObject.Find("Skill2Button").GetComponent <Button> ();
        action [4] = GameObject.Find("Skill3Button").GetComponent <Button> ();
        for (int i = 0; i < action.Length; i++)
        {
            action [i].GetComponent <ButtonsUI> ().CM = this;
        }

        // Get text components and the end buttons
        combatAction = GameObject.Find("CombatAction").GetComponent <Text> ();
        combatLog    = GameObject.Find("CombatLog").GetComponentInChildren <CombatLog> ();
        //ballsCaught = new System.Collections.Generic.List<bool>();

        // This sets up the character's healthbars and sets their allies and enemies internally
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                Player [i].allies [j]  = Player [j];
                Player [i].enemies [j] = Enemy [j];
                Enemy [i].allies [j]   = Enemy [j];
                Enemy [i].enemies [j]  = Player [j];
            }
        }
        AI = gameObject.GetComponentInChildren <EnemyAI> ();
    }
Example #7
0
 public virtual void Init(CombatManager CM, CharacterSelectUI combatUI)
 {
     this.combat = CM;
     this.CSUI   = combatUI;
 }
Example #8
0
 public void Init(CharacterSelectUI ui)
 {
     _myRect     = GetComponent <RectTransform>();
     _playerTeam = new List <DraggableCharacter>();
     _uiRef      = ui;
 }