Ejemplo n.º 1
0
    // This is called once the user hits play. Before the first frame
    void Awake()
    {
        CURSOR = GameObject.FindObjectOfType <Cursor>();
        MOVE_MENU_CONTROLLER = GameObject.FindObjectOfType <MoveMenuController>();
        MAP_GENERATOR        = GameObject.FindObjectOfType <MapGenerator>();
        CAMERA_CONTROLLER    = GameObject.FindObjectOfType <CameraController>();
        TOP_BAR           = GameObject.FindObjectOfType <TopBar>();
        LAST_TIME_CANCEL  = Time.time;
        LAST_TIME_CONFIRM = Time.time;
        LAST_TIME_UP      = Time.time;
        LAST_TIME_DOWN    = Time.time;
        LAST_TIME_LEFT    = Time.time;
        LAST_TIME_RIGHT   = Time.time;
        characters        = new ArrayList();

        enemyPositions    = new ArrayList();
        summonPositions   = new ArrayList();
        moveTilePositions = new ArrayList();
        charsInRange      = new ArrayList();
        players           = new Player[2];
        gameOver          = false;

        //get an understanding of the map
        for (int i = 0; i < players.Length; i++)
        {
            players[i] = new Player(i + 1);
            Summoner summoner = makeSummoner(i + 1);
            players[i].setSummoner(summoner.GetComponent <Summoner>());
            players[i].setGamePad(new Gamepad("keyboard"));
        }

        for (int i = players.Length; i < MAX_NUM_PLAYERS; i++)
        {
            GameObject.Destroy(GameObject.Find("PlayerDisplay" + (i + 1)));
        }
        switch (players.Length)
        {
        case 3:
            GameObject bar3 = GameObject.Find("PlayerDisplay1");
            bar3 = bar3.transform.Find("P1Bar").gameObject;
            bar3.transform.localScale = new Vector2(bar3.transform.localScale.x, 100);
            break;

        case 2:
            for (int i = 0; i < players.Length; i++)
            {
                GameObject bar2 = GameObject.Find("PlayerDisplay" + (i + 1));
                bar2 = bar2.transform.Find("P" + (i + 1) + "Bar").gameObject;
                bar2.transform.localScale = new Vector2(bar2.transform.localScale.x, 100);
            }
            break;

        default:
            break;
        }
    }
Ejemplo n.º 2
0
    /*
     * -------------------------------------------------------------------------
     * MARK: LIFECYCLE FUNCTIONS
     * -------------------------------------------------------------------------
     */

    void Awake()
    {
        battleController     = GetComponent <BattleController>();
        moveMenuController   = GetComponent <MoveMenuController>();
        attackMenuController = GetComponent <AttackMenuController>();
    }