Example #1
0
    // Use this for initialization
    void Start()
    {
        var agent = (Citizen)AgentFactory.CreateAgent(AgentClass.Adult);

        agent.setAgent_name("Joe Smith");

        AgentFactory.CreateAgent(AgentClass.Adult);

        BuildingFactory.createBuilding(BuildingClass.Residential);
    }
Example #2
0
    private bool buildAtMouse()
    {
        Ray   ray      = Camera.main.ScreenPointToRay(Input.mousePosition);
        Plane plane    = new Plane(Vector3.up, Vector3.zero);
        float distance = 0;

        if (plane.Raycast(ray, out distance))
        {
            Vector3    intersect = ray.GetPoint(distance);
            int        row       = Mathf.FloorToInt(intersect.x);
            int        col       = Mathf.FloorToInt(intersect.z);
            GameObject prefab    = BuildingFactory.getBuildingPrefab(currentBuildingType);
            if (gridManager.canBuildAt(prefab, row, col))
            {
                //if (!gridManager.wouldBlockPathAt(prefab, row, col)) {
                return(gridManager.placeBuildingAt(BuildingFactory.createBuilding(currentBuildingType), row, col));
                //}
            }
        }
        return(false);
    }