Example #1
0
        public ModelsEx(MainWindow window)
            : base(4)
        {
            // only enabled first pipeline
            for (int i = 1; i < NumPipelines; ++i)
            {
                Pipelines[i].IsEnabled = false;
            }

            Settings     = new SettingsModel();
            Window       = new WindowModel(window);
            Display      = new DisplayModel(this);
            ExportConfig = new ExportConfigModel();
            ViewData     = new TextureViewData(this);

            var stats = new List <StatisticModel>();

            for (int i = 0; i < NumPipelines; ++i)
            {
                stats.Add(new StatisticModel(this, Display, i));
            }
            Statistics = stats;

            ZoomBox = new BoxOverlay(this);
            Overlay.Overlays.Add(ZoomBox);

            resizeController       = new ResizeController(this);
            computeImageController = new ComputeImageController(this);
            paintController        = new PaintController(this);
            clientDropController   = new ClientDropController(this);
            cropController         = new CropController(this);
        }
Example #2
0
    public CropController GetCrop(string pName)
    {
        CropController crop = null;

        Crops.TryGetValue(pName, out crop);
        return(crop);
    }
Example #3
0
    void Apply()
    {
        TargetModel      = GetComponent <CropModel>();
        TargetController = GetComponent <CropController>();


        VariableName = name + LevelName + transform.position.x.ToString("F2") + transform.position.ToString("F2");

        TargetController.Plot = GetPlot(transform.position);

        TargetModel.CurrentStage       = DialogueLua.GetVariable(VariableName + "CurrentStage").asInt;
        TargetModel.CurrentStageGrowth = DialogueLua.GetVariable(VariableName + "CurrentStageGrowth").asInt;
        TargetModel.WateredToday       = DialogueLua.GetVariable(VariableName + "WateredToday").asBool;
        TargetModel.CurrentlyWatered   = DialogueLua.GetVariable(VariableName + "CurrentlyWatered").asBool;
        TargetModel.StageWaterLevel    = DialogueLua.GetVariable(VariableName + "StageWaterLevel").asInt;
        TargetModel.StageSunLevel      = DialogueLua.GetVariable(VariableName + "StageSunLevel").asInt;
        TargetModel.CurrentWilt        = DialogueLua.GetVariable(VariableName + "CurrentWilt").asInt;
        TargetModel.Quality            = DialogueLua.GetVariable(VariableName + "Quality").asFloat;
        TargetModel.TimeSinceWatered   = DialogueLua.GetVariable(VariableName + "TimeSinceWatered").asInt;


        print("Plot: " + TargetController.Plot);

        TargetController.Plot.Crop = TargetController;
        TargetController.Load();
    }
Example #4
0
 public override void Start()
 {
     base.Start();
     TargetModel      = GetComponent <CropModel>();
     TargetController = GetComponent <CropController>();
     LevelName        = GameManager.Instance.LevelName;
 }
    public void RemoveCrop()
    {
        GameObject.Destroy(currentCrop);

        currentCrop = null;
        cropController = null;
    }
    public void CropPlanted(GameObject cropPrefab)
    {
        // Spawn the crop and set it to have the tile as it's parent
        currentCrop = GameObject.Instantiate(cropPrefab);
        currentCrop.transform.SetParent(gameObject.transform);

        // Set the location of the crop
        currentCrop.transform.localPosition = Vector3.zero;

        // Cache the crop controller
        cropController = currentCrop.GetComponent<CropController>();
    }
Example #7
0
    public void OnRecordPersistentData()
    {
        //  print("RECORD");
        TargetModel      = GetComponent <CropModel>();
        TargetController = GetComponent <CropController>();

        VariableName = name + LevelName + transform.position.x.ToString("F2") + transform.position.ToString("F2");
        DialogueLua.SetVariable(VariableName + "CurrentStage", TargetModel.CurrentStage);
        DialogueLua.SetVariable(VariableName + "CurrentStageGrowth", TargetModel.CurrentStageGrowth);
        DialogueLua.SetVariable(VariableName + "WateredToday", TargetModel.WateredToday);
        DialogueLua.SetVariable(VariableName + "CurrentlyWatered", TargetModel.CurrentlyWatered);
        DialogueLua.SetVariable(VariableName + "StageWaterLevel", TargetModel.StageWaterLevel);
        DialogueLua.SetVariable(VariableName + "StageSunLevel", TargetModel.StageSunLevel);
        DialogueLua.SetVariable(VariableName + "CurrentWilt", TargetModel.CurrentWilt);
        DialogueLua.SetVariable(VariableName + "Quality", TargetModel.Quality);
        DialogueLua.SetVariable(VariableName + "TimeSinceWatered", TargetModel.TimeSinceWatered);
    }
Example #8
0
    public bool PlantCrop(ItemTool pTool)
    {
        // if crop is already planted
        if (Crop != null)
        {
            return(false);
        }

        string cropName = pTool.CropName;

        CropController CropPrefab = FarmingManager.Instance.GetCrop(cropName);

        if (CropPrefab == null)
        {
            Debug.LogError("Crop not found in manager");
            return(false);
        }

        Crop = Instantiate(CropPrefab, transform.position, transform.rotation);
        Crop.Plant(CurrentlyWatered, this);

        return(true);
    }
Example #9
0
 public void CropDestroyed()
 {
     Crop = null;
 }