/********* ** Public Methods *********/ /// <summary>Constructs an instance.</summary> /// <param name="dateAvailable">The date the seeds become available.</param> /// <param name="growthTime">The number of days it takes the plant to grow.</param> /// <param name="harvest">The number of items that are produced by the plant.</param> /// <param name="harvestWithTending">The number of items that are produced by the plant once you've read the gardening book.</param> /// <param name="seed">The plant's seed.</param> /// <param name="products">The products the plant can produce.</param> public Plant(string dateAvailable, int growthTime, int harvest, int harvestWithTending, PlantSeed seed, List <PlantProduct> products) { DateAvailable = dateAvailable; GrowthTime = growthTime; Harvest = harvest; HarvestWithTending = harvestWithTending; Seed = seed; Products = products ?? new(); }
void OnTriggerEnter(Collider other) { PlantSeed ps = other.GetComponent <PlantSeed>(); if (ps != null) { ps.Plant(ps.transform.position, this.transform); } }
public MachinesController(PlantManagerContext context, ILogger <MachinesController> logger) { _context = context; _logger = logger; if (_context.Machines.Any()) { return; } PlantSeed.InitData(context); }
public void Drop() { isPlant = false; if (m_seed != null) { Destroy(m_seed.gameObject); m_seed = null; } }
public DepartmentsController(PlantManagerContext context, ILogger <DepartmentsController> logger) { _context = context; _logger = logger; if (_context.Departments.Any()) { return; } PlantSeed.InitData(context); }
public CostCentersController(PlantManagerContext context, ILogger <CostCentersController> logger) { _context = context; _logger = logger; if (_context.CostCenters.Any()) { return; } PlantSeed.InitData(context); }
public override void UpdatePlantSprite() { if (Dictioary == null) { Dictioary = GameObject.FindGameObjectWithTag("TileMapManager").GetComponent <TileDictionaryClass>(); } Seeds = GameObject.FindObjectOfType <PlantSeed>(); PlantAbstractClass PrefabTurnip = Dictioary.TileMapData.ElementAt(0).Value[ID].GetPlant(); SpriteRenderer S = Dictioary.TileMapData.ElementAt(0).Value[ID].Clone.GetComponent <SpriteRenderer>(); S.sprite = PrefabTurnip.mGrowthSprites[PrefabTurnip.mSpriteIndex]; }
public PlantData(PlantSeed plant) { for (int i = 0; i < plants.Length; i++) { if (plants[i].IsSpawned()) { savedPlants[i] = 1; } } position = new float[3]; position[0] = plant.transform.position.x; position[1] = plant.transform.position.y; position[2] = plant.transform.position.z; }
private void Awake() { // Gets the parent's plantSeed parent = gameObject.GetComponentInParent <PlantSeed>(); child = Instantiate(seed, gameObject.transform.position, Quaternion.identity, gameObject.transform); // Starts at not ready to pick ready = false; // Adds pointer controlls //gameObject.AddListener(EventTriggerType.PointerDown, Hold); //gameObject.AddListener(EventTriggerType.PointerUp, Release); gameObject.AddListener(EventTriggerType.PointerClick, pick); // These decrease the water level and increase time as time goes on StartCoroutine(passTime()); StartCoroutine(waterDry()); }
public void Plant() { if (seedTimer < 0) { isPlant = false; m_seed.GetComponentInChildren <SpriteRenderer>().sortingLayerName = "Default"; m_seed.GetComponentInChildren <SpriteRenderer>().sortingOrder = 0; m_seed.CreateRoot(m_velocity.normalized); m_seed.transform.parent = null; m_seed = null; seedTimer = seedRenewDuration; } }
public async void ScrollCellIndex(int idx) { //数据 var listSeed = StaticData.GetPlantSeeds(); currPlantSeed = listSeed[idx]; if (currPlantSeed == null) { return; } await SetUIInfo(); this.CropGoodId = currPlantSeed.idSeed; var manorCropDefine = StaticData.configExcel.ManorCrop.Find(x => x.IdSeed == currPlantSeed.idSeed); var gameItemDefine = StaticData.configExcel.GetGameItemByID(manorCropDefine.IdGainGameItem); goPrefab = await ABManager.GetAssetAsync <GameObject>(manorCropDefine.Model); }
public bool GetSeed(PlantSeed seed) { if (!isPlant) { Debug.Log("Plant " + seed.name); isPlant = true; m_seed = seed; m_seed.transform.parent = transform; m_seed.transform.localPosition = Vector3.up * 0.33f; m_seed.GetComponentInChildren <SpriteRenderer>().sortingLayerName = "Player"; m_seed.GetComponentInChildren <SpriteRenderer>().sortingOrder = 10; m_source.clip = pickSound; m_source.Play(); return(true); } return(false); }
public void AddSeedToInventory(PlantSeed seed) { AddSeedToInventoryFromIndex(seed.indexInPlantManager); }