public void AddCluster(ClusterControl cluster) { GameObject clusterMarkerPrefab = GameManager.Instance.GetPrefab("UI_ClusterMarker"); GameObject newClusterMarker = Instantiate(clusterMarkerPrefab, clusterDisplay.transform); UIClusterMarker marker = newClusterMarker.GetComponent <UIClusterMarker>(); clusterMarkers.Add(marker); marker.control = cluster; }
public void AttackCluster(ClusterControl targetCluster) { for (int i = 0; i < Units.Count; i++) { if (Units[i].Brain.State.Equals("Idle")) { Units[i].Brain.AttackTarget(targetCluster.Units[i % targetCluster.Units.Count], true); } } }
void Start() { animator = GetComponent <Animator>(); gameManager = GameManager.Instance; cameraControl = gameManager.GameCamera; UseCameraLook = true; UsePlayerControl = true; UseIKControl = true; cluster = AddCluster(clusterDescription); }
ClusterControl AddCluster(ClusterDescription description) { GameObject clusterObj = Instantiate(gameManager.GetPrefab("Cluster")); ClusterControl newCluster = clusterObj.GetComponent <ClusterControl>(); newCluster.clusterDescription = description; newCluster.HideUI = true; newCluster.KeepUpdated = true; return(newCluster); }
public void AddCluster(ClusterControl newCluster) { if (!newCluster.tag.Equals("Friend")) { return; } clusters.Add(newCluster); IngameUI.AddCluster(newCluster); }
public void SelectCluster(ClusterControl cluster) { if (selectedCluster) { selectedCluster.unitLost.RemoveAllListeners(); } selectedCluster = cluster; BuildLayout(selectedCluster); cluster.unitLost.AddListener(OnSelectedClusterChange); }
public void RemoveCluster(ClusterControl cluster) { foreach (var item in clusterMarkers) { if (item.control == cluster) { clusterMarkers.Remove(item); break; } } }
public void RemoveCluster(ClusterControl deadCluster) { if (!deadCluster.tag.Equals("Friend")) { return; } DeselectCluster(deadCluster); clusters.Remove(deadCluster); IngameUI.RemoveCluster(deadCluster); }
public void DeselectCluster(ClusterControl deselected) { if (!deselected.tag.Equals("Friend")) { return; } if (!SelectedCluster || SelectedCluster != deselected) { return; } SelectedCluster = null; IngameUI.DeSelectCluster(deselected); deselected.Select(false); }
public UICluster Init() { inputControl = GameManager.Instance.InputControl; clusterControl = transform.GetComponentInParent <ClusterControl>(); mainCamera = Camera.main; uiBackground = transform.Find("Background").GetComponent <Image>(); uiBackground.gameObject.AddComponent <InputRelay>().Init(gameObject); unitType = transform.Find("Background/Type").GetComponent <Image>(); selectColorIn.onTickVector += OnSelectColorIn; selectColorOut.onTickVector += OnSelectColorOut; selectType.onTickVector += OnSelectType; IsSelected = false; isReady = true; return(this); }
public void BuildLayout(ClusterControl cluster) { ClearLayout(); clusterTitle.text = cluster.name; if (cluster.Count < 1) { return; } int layoutWidth = Mathf.CeilToInt(Mathf.Sqrt(cluster.Count)); float cellSize = Mathf.Clamp( (clusterLayout.sizeDelta.x - clusterGrid.padding.left - clusterGrid.padding.right) / layoutWidth, 1, 27.5f ); clusterGrid.constraintCount = layoutWidth; clusterGrid.cellSize = new Vector2(cellSize, cellSize); int typeCount = 0; string lastType = cluster.Units[typeCount].UnitType; if (poolCount < cluster.Count) { FillHoldingArea(cluster.Count - poolCount); } for (int i = 0; i < cluster.Count; i++) { Transform unitMarker = unitMarkerPool.GetChild(0); unitMarker.SetParent(clusterLayout); Image unitMarkerImage = unitMarker.GetComponent <Image>(); if (!cluster.Units[i].UnitType.Equals(lastType)) { typeCount++; lastType = cluster.Units[i].UnitType; } unitTypeEntries[typeCount].AddCount(); unitMarkerImage.material = unitTypeEntries[typeCount].TypeMaterial; } }
public virtual Selector Init(ClusterControl clusterControl) { cluster = clusterControl; inputControl = GameManager.Instance.InputControl; inputControl.onEnterCtrlMode += onEnterCtrlMode; inputControl.onExitCtrlMode += onExitCtrlMode; startMarker = new GameObject("Start").transform; startMarker.SetParent(transform); endMarker = new GameObject("End").transform; endMarker.SetParent(transform); moveHandle = transform.Find("Move"); moveHandle.gameObject.AddComponent <InputRelay>().Init(gameObject); moveMaterial = moveHandle.GetComponent <Renderer>().material; Setup(); return(this); }
public void SelectCluster(ClusterControl selected) { if (!selected.tag.Equals("Friend")) { return; } foreach (ClusterControl cluster in clusters) { if (cluster != selected) { cluster.Select(false); } } if (!clusters.Contains(selected)) { clusters.Add(selected); } IngameUI.SelectCluster(selected); SelectedCluster = selected; selected.Select(true); }
public void DeSelectCluster(ClusterControl cluster) { selectedCluster.unitLost.RemoveAllListeners(); selectedCluster = null; ClearLayout(); }
void Start() { cam = Camera.main; control = GetComponent <ClusterControl>(); }
void Button1Pressed() { ClusterControl selectedCluster = inputControl.SelectedCluster; selectedCluster.Release("hello"); }
public void DeSelectCluster(ClusterControl cluster) { clusterLayout.DeSelectCluster(cluster); }
public UnitOrder(ClusterControl cluster, string unitType, int amount) { this.owner = cluster; this.unitType = unitType; this.amount = amount; }