Example #1
0
    public GameObject GetWellWalker(IntPoint2D tileLoc, ScenarioMgr.Direction facing)
    {
        //Debug.Log ("Retrieving well walker");
        Vector3    topLeft = scenario.ComputeTopLeftPointOfTile(tileLoc);
        GameObject walker;

        walker = (GameObject)Instantiate(wellWalkerPrefab);
        walker.transform.position = topLeft + new Vector3(walkerHorizOffset, walkerVertOffset, walkerHorizOffset);
        walker.transform.rotation = Quaternion.identity;
        if (facing == ScenarioMgr.Direction.Up)
        {
            walker.transform.Rotate(0, 90, 0);
        }
        else if (facing == ScenarioMgr.Direction.Left)
        {
            walker.transform.Rotate(0, 180, 0);
        }
        else if (facing == ScenarioMgr.Direction.Down)
        {
            walker.transform.Rotate(0, 270, 0);
        }

        walker.SetActive(true);
        return(walker);
    }
    public GameObject GetGreenGhost(int arrayIndex, IntPoint2D tileLoc)
    {
        Vector3    topLeft = scenario.ComputeTopLeftPointOfTile(tileLoc);
        GameObject obj     = (GameObject)Instantiate(greenPrefabs[arrayIndex]);

        obj.transform.position = topLeft + GetObjTransform(arrayIndex);
        return(obj);
    }
Example #3
0
    private GameObject CreateHouse(GameObject prefabHouse, IntPoint2D tileIndex)
    {
        Vector3 topLeft = scenario.ComputeTopLeftPointOfTile(tileIndex);

        GameObject house = (GameObject)Instantiate(prefabHouse);

        house.transform.position = topLeft + new Vector3(houseOffset, houseOffset, houseOffset);

        return(house);
    }
Example #4
0
    public void DoDelivery(IntPoint2D startingTile, Stack <IntPoint2D> path, StoreManager storeMgr)
    {
        int amtToDeliver = Mathf.Min(kDeliveryCapacity, curCropAmt);

        curCropAmt = curCropAmt - amtToDeliver;
        GameObject delPerson = (GameObject)Instantiate(deliveryPrefab);
        Vector3    topLeft   = scenarioMgr.ComputeTopLeftPointOfTile(startingTile);

        delPerson.transform.position = topLeft + new Vector3(.5f, .2f, .5f);
        DeliveryManager delMgr = delPerson.GetComponent("DeliveryManager") as DeliveryManager;

        delMgr.SetUp(scenarioInfo, startingTile, path, storeMgr, amtToDeliver);
    }
    private GameObject CreateRoadTile(GameObject prefabRoad, IntPoint2D tileIndex)
    {
        Vector3 roadPoint = scenario.ComputeTopLeftPointOfTile(tileIndex);

        Debug.Log("Creating a road Tile at");
        Debug.Log(roadPoint);

        GameObject road = (GameObject)Instantiate(prefabRoad);

        road.transform.position = roadPoint + roadOffset;

        Debug.Log(road.transform.position);

        return(road);
    }