Пример #1
0
    // Use this for initialization
    void Start()
    {
        GameObject clan = GameObject.Find ("Clan");
        theClan = clan.GetComponent<Clan>();

        GameObject cam = GameObject.Find ("MainCamera");
        ourCam = cam.GetComponent<Camera>();

        GameObject listener = GameObject.Find ("ClanGUI");
        Listener = listener.GetComponent<GUIListener>();

        GameObject guicam = GameObject.Find ("GuiCamera");
        guiCam = guicam.GetComponent<Camera>();

        GameObject target = GameObject.Find("FirstSprite");
        spriteToMove = target.GetComponent<faceMover>();

        Listener.guiCam = guiCam;

        placeList = new Place[transform.childCount];
        int i = 0;
        foreach (Transform child in transform) {
            placeList[i] = child.GetComponent<Place>();
            Debug.Log(i +": "+ placeList[i].placeName);
            i++;
        }
        currentPlace = placeList [0];
        targetPlace = placeList [0];
        Debug.Log ("Current Place: " + currentPlace.placeName);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        turnOrder.gameState = TurnOrder.MacroState.Placement;
        GameObject stackage = GameObject.Find("Stats");
        turnOrder.turnOrderGui.iconPackage = stackage.GetComponent<StatTextures>();
        float scalar = Mathf.Max (height / 6f, width/12f);
        sq.transform.localScale = new Vector3(1/scalar, 1/scalar, 1);
        float sqWidth = sq.icon.textureRect.width;
        sqExtents = sq.icon.bounds.extents;
        sqExtents.x = sqExtents.x * sq.transform.localScale.x;
        sqExtents.y = sqExtents.y * sq.transform.localScale.y;
        Debug.Log("Sq Width: "+sqWidth);
        Debug.Log("Sq Extents: "+sqExtents);
        lowerLeft = new Vector3(0- (width-1) * sqExtents.x, 0-(height-1) * sqExtents.y, 0);
        board = new SquareIcon[height, width];
        for(int column = 0; column < width; column++){
            for (int row = 0; row < height; row++){
                board[row, column] = Instantiate(sq, new Vector3(lowerLeft.x + column*sqExtents.x*2, lowerLeft.y + row*sqExtents.y*2, 0), Quaternion.identity) as SquareIcon;
                board[row,column].row = row;
                board[row,column].col = column;
            }
        }

        GameObject clanObj = GameObject.Find ("Clan");
        theClan = clanObj.GetComponent<Clan>();
        Debug.Log ("Found clan with members: " + theClan.clanMembers.Count);

        GameObject clanGuiObj = GameObject.Find ("ClanGUI");
        clanGui = clanGuiObj.GetComponent<GUIListener>();

        clanGui.guiCam = myCam;

        CombatCharacter blankGob = (CombatCharacter) library.getAssetByName("goblin");

        List<CombatCharacter> creeps = new List<CombatCharacter>();
        int numGobs = 3;
        for(int i = 0; i < numGobs; i++)
            creeps.Add (blankGob);

        CombatCharacter blankHero = (CombatCharacter) library.getAssetByName("blankcharacter");

        List<CombatCharacter> heroes = new List<CombatCharacter>();
        foreach (Character hero in theClan.clanMembers){
            heroes.Add (blankHero);
        }

        PopulateFighters(creeps, heroes);
        toBePlaced = new Queue<CombatCharacter>(turnOrder.fighters);
    }