Тогда смотри какое у меня задание, я сейчас скачал стартер кит для создания стратегии, у него есть гайд, но он на версию 2018 года, мне нужно, чтобы ты использовал его документацию и объяснил мне, как сделать свою игру на его основе на версии unity 6.1
Если нужно, вот ссылка в гугл доке https://docs.google.com/document/d/1jM-qJoNewQ2HnpzaUbwVG6VSX94sXPAGT5YRK15mUDA/edit?tab=t.0
1)Обновил постПроцессинг до 3.4.0
2)Перезашёл в проект, теперь такие ошибки:
Assets\InsaneSystems\RTSStarterKit\Scripts\UI\ControlsButtons.cs(9,20): error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)
Assets\InsaneSystems\RTSStarterKit\Scripts\UI\UIController.cs(11,20): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)
Assets\InsaneSystems\RTSStarterKit\Scripts\UI\Production\ProductionTypeButton.cs(15,3): error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)
Assets\InsaneSystems\RTSStarterKit\Scripts\UI\Production\ProductionTypeButton.cs(14,3): error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
Assets\InsaneSystems\RTSStarterKit\Scripts\UI\Production\UnitIcon.cs(15,3): error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
Вот код ContolsButtons.cs
using InsaneSystems.RTSStarterKit.Controls;
using UnityEngine;
using UnityEngine.UI;
namespace InsaneSystems.RTSStarterKit.Scripts.UI
{
public class ControlsButtons : MonoBehaviour
{
[SerializeField] Button repairButton, sellButton;
void Start()
{
if (repairButton)
repairButton.onClick.AddListener(delegate
{
InputHandler.sceneInstance.SetCustomControls(CustomControls.Repair);
});
if (sellButton)
sellButton.onClick.AddListener(delegate
{
InputHandler.sceneInstance.SetCustomControls(CustomControls.Sell);
});
}
}
}
UIController.cs
using UnityEngine;
using UnityEngine.UI;
namespace InsaneSystems.RTSStarterKit.UI
{
public class UIController : MonoBehaviour
{
public static UIController instance { get; protected set; }
[SerializeField] Canvas mainCanvas;
[SerializeField] Text moneyText;
[SerializeField] GameObject winScreen;
[SerializeField] GameObject loseScreen;
public Minimap minimapComponent { get; protected set; }
public ProductionHint productionHint { get; protected set; }
public SelectProductionNumberPanel selectProductionNumberPanel { get; protected set; }
public MinimapSignal minimapSignal { get; protected set; }
public CarryingUnitList carryingUnitList { get; protected set; }
public PauseMenu pauseMenu { get; protected set; }
public UnitAbilities unitAbilities { get; protected set; }
public ProductionIconsPanel productionIconsPanel { get; protected set; }
SelectProductionTypePanel selectProductionPanel;
public Canvas MainCanvas { get { return mainCanvas; } }
void Awake()
{
instance = this;
minimapComponent = GetComponent<Minimap>();
productionHint = GetComponent<ProductionHint>();
selectProductionPanel = GetComponent<SelectProductionTypePanel>();
selectProductionNumberPanel = GetComponent<SelectProductionNumberPanel>();
minimapSignal = GetComponent<MinimapSignal>();
carryingUnitList = GetComponent<CarryingUnitList>();
pauseMenu = GetComponent<PauseMenu>();
unitAbilities = GetComponent<UnitAbilities>();
productionIconsPanel = GetComponent<ProductionIconsPanel>();
}
void Start()
{
Unit.unitDestroyedEvent += Healthbar.RemoveHealthbarOfUnit;
Controls.Selection.unitSelected += Healthbar.SpawnHealthbarForUnit;
Controls.Selection.selectionCleared += Healthbar.RemoveAllHealthbars;
Unit.unitHoveredEvent += OnUnitHovered;
Unit.unitUnhoveredEvent += OnUnitUnhovered;
OnPlayerMoneyChanged(GameController.instance.playersController.playersIngame[Player.localPlayerId].money);
Player.localPlayerMoneyChangedEvent += OnPlayerMoneyChanged;
}
void OnUnitHovered(Unit unit)
{
if (unit.isSelected || !unit.GetModule<FogOfWarModule>().isVisibleInFOW)
return;
Healthbar.SpawnHealthbarForUnit(unit);
}
void OnUnitUnhovered(Unit unit)
{
if (unit.isSelected)
return;
Healthbar.RemoveHealthbarOfUnit(unit);
}
public void OnGameInitialized()
{
selectProductionPanel.OnSelectButtonClick(GameController.instance.MainStorage.availableProductionCategories[0]);
}
public void ShowWinScreen() { winScreen.SetActive(true); }
public void ShowDefeatScreen() { loseScreen.SetActive(true); }
void OnPlayerMoneyChanged(int moneyValue) { moneyText.text = "$" + moneyValue; }
void OnDestroy()
{
Unit.unitDestroyedEvent -= Healthbar.RemoveHealthbarOfUnit;
Player.localPlayerMoneyChangedEvent -= OnPlayerMoneyChanged;
Controls.Selection.unitSelected -= Healthbar.SpawnHealthbarForUnit;
Controls.Selection.selectionCleared -= Healthbar.RemoveAllHealthbars;
Unit.unitHoveredEvent -= Healthbar.SpawnHealthbarForUnit;
Unit.unitUnhoveredEvent -= Healthbar.RemoveHealthbarOfUnit;
}
}
}
ProductionTypeButton.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace InsaneSystems.RTSStarterKit.UI
{
public class ProductionTypeButton : MonoBehaviour
{
[SerializeField] ProductionCategory productionCategory;
SelectProductionTypePanel controllerPanel;
Image selfImage;
Button selfButton;
Color defaultColor;
public ProductionCategory GetProductionCategory
{
get { return productionCategory; }
}
void Awake()
{
selfImage = GetComponent<Image>();
selfButton = GetComponent<Button>();
defaultColor = selfImage.color;
}
void Start() { Redraw(); }
public void SetActive() { selfImage.color = Color.green; }
public void SetUnactive() { selfImage.color = defaultColor; }
public void OnClick() { controllerPanel.OnSelectButtonClick(productionCategory); }
public void Redraw()
{
selfButton.interactable = Player.GetLocalPlayer().IsHaveProductionOfCategory(productionCategory);
}
public void SetupWithController(SelectProductionTypePanel typePanel) { controllerPanel = typePanel; }
public void SetupWithProductionCategory(ProductionCategory category)
{
productionCategory = category;
selfImage.sprite = category.icon;
Redraw();
}
}
}
ProductionTypeButton.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace InsaneSystems.RTSStarterKit.UI
{
public class ProductionTypeButton : MonoBehaviour
{
[SerializeField] ProductionCategory productionCategory;
SelectProductionTypePanel controllerPanel;
Image selfImage;
Button selfButton;
Color defaultColor;
public ProductionCategory GetProductionCategory
{
get { return productionCategory; }
}
void Awake()
{
selfImage = GetComponent<Image>();
selfButton = GetComponent<Button>();
defaultColor = selfImage.color;
}
void Start() { Redraw(); }
public void SetActive() { selfImage.color = Color.green; }
public void SetUnactive() { selfImage.color = defaultColor; }
public void OnClick() { controllerPanel.OnSelectButtonClick(productionCategory); }
public void Redraw()
{
selfButton.interactable = Player.GetLocalPlayer().IsHaveProductionOfCategory(productionCategory);
}
public void SetupWithController(SelectProductionTypePanel typePanel) { controllerPanel = typePanel; }
public void SetupWithProductionCategory(ProductionCategory category)
{
productionCategory = category;
selfImage.sprite = category.icon;
Redraw();
}
}
}
UnitIcon.cs
using InsaneSystems.RTSStarterKit.Controls;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace InsaneSystems.RTSStarterKit.UI
{
public class UnitIcon : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
[SerializeField] Image fillImage;
[SerializeField] Image iconImage;
[SerializeField] Button button;
[SerializeField] Text countText, hotkeyText;
[SerializeField] GameObject hotkeyPanel;
Image hotkeyBG;
UnitData unitDataTemplate;
ProductionIconsPanel selfProductionIconsPanel;
RectTransform rectTransform;
void Start()
{
rectTransform = GetComponent<RectTransform>();
if (hotkeyPanel)
hotkeyBG = hotkeyPanel.GetComponent<Image>();
}
void HotkeyDrawMode(bool visible)
{
if (!hotkeyBG)
return;
var color = hotkeyBG.color;
color.a = visible ? 1f : 0.25f;
hotkeyBG.color = color;
}
void Update() { Redraw(); }
public void Redraw()
{
var selectedProduction = SelectProductionNumberPanel.selectedBuildingProduction;
bool isBuilding = IsBuildingType();
bool isInProductionQueue = selectedProduction.IsUnitOfTypeInQueue(unitDataTemplate);
if (!selectedProduction)
return;
iconImage.sprite = unitDataTemplate.icon;
if (selectedProduction.IsUnitOfTypeCurrentlyBuilding(unitDataTemplate))
fillImage.fillAmount = 1f - selectedProduction.GetBuildProgressPercents();
else if ((isBuilding && isInProductionQueue) || (!isBuilding && isInProductionQueue))
fillImage.fillAmount = 1f;
else
fillImage.fillAmount = 0f;
int unitsCount = selectedProduction.GetUnitsOfSpecificTypeInQueue(unitDataTemplate);
countText.text = unitsCount > 0 ? unitsCount.ToString() : "";
if (isBuilding && IsAnyBuildingInQueue(selectedProduction))
SetActive(IsCurrentBuildingInQueue(selectedProduction));
HotkeyDrawMode(InputHandler.hotkeysInputMode == HotkeysInputType.Building);
}
public void SetHotkeyById(int id)
{
if (!GameController.instance.MainStorage.showHotkeysOnUI)
{
hotkeyPanel.SetActive(false);
return;
}
hotkeyText.text = InputHandler.sceneInstance.buildingInputKeys[id].ToString();
}
public void OnPointerClick(PointerEventData eventData)
{
if (eventData.button == PointerEventData.InputButton.Left)
OnClick();
else if (eventData.button == PointerEventData.InputButton.Right)
OnRightClick();
}
public void OnClick()
{
var selectedProduction = SelectProductionNumberPanel.selectedBuildingProduction;
if (!selectedProduction)
return;
if (IsBuildingType())
{
bool isBuildingReady = IsCurrentBuildingInQueue(selectedProduction) && selectedProduction.IsBuildingReady();
if (IsAnyBuildingInQueue(selectedProduction))
{
if (isBuildingReady)
GameController.instance.build.EnableBuildMode(unitDataTemplate.selfPrefab, () =>
{
selectedProduction.FinishBuilding();
selfProductionIconsPanel.Redraw();
});
return;
}
}
selectedProduction.AddUnitToQueue(unitDataTemplate);
}
void OnRightClick()
{
var selectedProduction = SelectProductionNumberPanel.selectedBuildingProduction;
if (!selectedProduction)
return;
selectedProduction.RemoveUnitFromQueue(unitDataTemplate, true);
selfProductionIconsPanel.Redraw();
}
bool IsAnyBuildingInQueue(Production production) { return production.unitsQueue.Count > 0; }
bool IsCurrentBuildingInQueue(Production production)
{
return production.unitsQueue.Count > 0 && production.unitsQueue[0] == unitDataTemplate;
}
bool IsBuildingType()
{
return SelectProductionTypePanel.selectedProductionCategory.isBuildings;
}
public void SetActive(bool value) { button.interactable = value; }
public void SetupWithUnitData(ProductionIconsPanel selfPanel, UnitData unitData)
{
selfProductionIconsPanel = selfPanel;
unitDataTemplate = unitData;
Redraw();
}
public void OnPointerEnter(PointerEventData pointerEventData)
{
UIController.instance.productionHint.Show(unitDataTemplate, rectTransform.position + new Vector3(0, rectTransform.sizeDelta.y / 2f + 10));
}
public void OnPointerExit(PointerEventData pointerEventData)
{
UIController.instance.productionHint.Hide();
}
}
}