Размещено 5 месяцев назад по предмету
Кыргыз тили
от
okok29953
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shaft : MonoBehaviour
{
[SerializeField] private shaftFarmer shaftFarmerPref;
[SerializeField] private Deposit depositPref;
[SerializeField] private Transform miningLocation;
[SerializeField] private Transform depositLocation;
[SerializeField] private Transform depositInstantiateLocation;
public Transform MiningLocation => miningLocation;
public Transform DEpositLocation => depositLocation;
public Deposit CurrentDeposit { get; set; }
private GameObject MinersContainer;
private List farmers;
[SerializeField] private GameObject polivSprite;
[SerializeField] private GameObject collectSprite;
public GameObject CollectSprite => collectSprite;
public GameObject PolivSprite => polivSprite;
public List Farmers => farmers;
private void Start()
{
farmers = new List ();
MinersContainer = new GameObject("Miners");
CreateFarmer();
CreateDeposit();
}
public void CreateFarmer()
{
shaftFarmer newFarmer = Instantiate(shaftFarmerPref, DEpositLocation.position, Quaternion.identity);
newFarmer.CurrentShaft = this;
newFarmer.transform.SetParent(MinersContainer.transform);
newFarmer.MoveFarmer(MiningLocation.position);
if (newFarmer != null)
{
farmers.Add(newFarmer);
}
if(farmers.Count>0)
{
newFarmer.CollectCapasity = farmers[0].CollectCapasity;
newFarmer.PolivDuration = farmers[0].PolivDuration;
}
}
private void CreateDeposit()
{
CurrentDeposit = Instantiate(depositPref, depositInstantiateLocation.position, Quaternion.identity);
CurrentDeposit.transform.SetParent(depositInstantiateLocation.transform);
}
}
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.