Exemplo n.º 1
0
    public void OccupiedHex()
    {
        GameObject liz       = GameObject.Find("Lizard");
        lizard     lizClass  = liz.GetComponent <lizard>();
        GameObject bird      = GameObject.Find("Bird");
        bird       birdClass = bird.GetComponent <bird>();

        if (lizClass.tileStr == birdClass.tileStr)
        {
            Battle();
        }
        else
        {
        }
    }
Exemplo n.º 2
0
    public void OccupiedHexList()
    {
        GameObject liz       = GameObject.Find("Lizard");
        lizard     lizClass  = liz.GetComponent <lizard>();
        GameObject bird      = GameObject.Find("Bird");
        bird       birdClass = bird.GetComponent <bird>();

        //
        //OccupiedHexs.Add("Placeholder", "Placeholder");

        OccupiedHexs.Clear();
        OccupiedHexs.Add(lizClass.tileStr, lizClass.name);
        OccupiedHexs.Add(birdClass.tileStr, birdClass.name);

        //Debug.Log(map.OccupiedHexs);
    }
    void OnMouseUp()

    {
        string           xstr;
        string           ystr;
        string           unityStr;
        string           unityStrX;
        string           unityStrY;
        GameObject       board = GameObject.Find("map");
        Map_v10          map   = board.GetComponent <Map_v10>();
        ClickableTile_v4 ct    = board.GetComponent <ClickableTile_v4>();

        GameObject liz    = GameObject.Find("Lizard");
        lizard     lizard = liz.GetComponent <lizard>();

        ct.clickX = tileX;
        ct.clickY = tileY;
        xstr      = tileX.ToString();
        ystr      = tileY.ToString();

        ct.clickCoor = "(" + xstr + ", " + ystr + ")";

        unityStr = map.tileLocPairs[ct.clickCoor];
        string[] tiles = unityStr.Split(new char[] { '(', ',', ')' });
        //x tile coordinate
        unityStrX = tiles[1];
        unityStrY = tiles[2];
        ct.xLoc   = float.Parse(unityStrX);
        //y tile coordinate
        ct.yLoc = float.Parse(unityStrY);


        lizard.lizardMove();
        lizard.characterLocationUpdate();



        /*
         * Debug.Log("Click!");
         * map.MoveUnitTo(xLoc, yLoc);
         * GameObject liz = GameObject.Find("Lizard");
         * lizard lizard = liz.GetComponent<lizard>();
         * lizard.characterLocationUpdate();
         */
    }
Exemplo n.º 4
0
    void OnMouseUp()

    {
        string xstr;
        string ystr;
        string unityStr;
        string unityStrX;
        string unityStrY;
        //testing
        int length;
        //end testing


        GameObject       board = GameObject.Find("map");
        Map_v10          map   = board.GetComponent <Map_v10>();
        ClickableTile_v4 ct    = board.GetComponent <ClickableTile_v4>();

        GameObject liz    = GameObject.Find("Lizard");
        lizard     lizard = liz.GetComponent <lizard>();



        ct.clickX = tileX;
        ct.clickY = tileY;
        xstr      = tileX.ToString();
        ystr      = tileY.ToString();

        ct.clickCoor = "(" + xstr + ", " + ystr + ")";

        unityStr = map.tileLocPairs[ct.clickCoor];
        string[] tiles = unityStr.Split(new char[] { '(', ',', ')' });
        //x tile coordinate
        unityStrX = tiles[1];
        unityStrY = tiles[2];
        ct.xLoc   = float.Parse(unityStrX);
        //y tile coordinate
        ct.yLoc = float.Parse(unityStrY);


        lizard.lizardMove();
        lizard.characterLocationUpdate();


        //test from here down(battle testing)
        battle_v1 battle = liz.GetComponent <battle_v1>();

        battle.OccupiedHex();
        battle.OccupiedHexList();

        length = battle.OccupiedHexs.Count;

        if (length == 0)
        {
            Debug.Log("No Occupied Hexs");
        }
        if (length >= 1)
        {
            foreach (var units in battle.OccupiedHexs)
            {
                Debug.Log("Key:" + units.Key + " Value:" + units.Value);
            }
        }

        /*
         * Debug.Log("Click!");
         * map.MoveUnitTo(xLoc, yLoc);
         * GameObject liz = GameObject.Find("Lizard");
         * lizard lizard = liz.GetComponent<lizard>();
         * lizard.characterLocationUpdate();
         */
    }