public void PaintDot(Dot dot, DotStatus dotStatus, string noBorder = null) { dot.status = dotStatus; if (dot.Label == null) { return; } Dispatcher.Invoke(() => { switch (dotStatus) { case DotStatus.Apple: dot.Label.Background = new SolidColorBrush(Colors.Red); break; case DotStatus.Snake: dot.Label.Background = new SolidColorBrush(Colors.Black); break; case DotStatus.Field: dot.Label.Background = new SolidColorBrush((dot.X + dot.Y) % 2 == 0 ? Colors.LightGray : Colors.White); break; } }); }
public void EnemyCapture() { currentStatus = DotStatus.EnemyUnpowered; foreach (MapLine line in connectedLines) line.SetOwners(); timer = 0.0f; mapControl.PowerDots(); SaveState(); }
private string GetFormattedDotOfferedState() { if (IsDotOffered == null) { return(null); } return(DotStatus == null ? IsDotOffered.GetDisplayName() : $"{IsDotOffered.GetDisplayName()} - {DotStatus.GetDisplayName()}"); }
// Update is called once per frame void Update() { if (Input.mousePosition.y > Screen.height - 10 && camera.transform.position.y < maxY) { camera.transform.Translate(0, moveSpeed * Time.deltaTime, 0); } if (Input.mousePosition.y < 10 && camera.transform.position.y > 0) { camera.transform.Translate(0, -moveSpeed * Time.deltaTime, 0); } if (Input.mousePosition.x > Screen.width - 10 && camera.transform.position.x < maxX) { camera.transform.Translate(moveSpeed * Time.deltaTime, 0, 0); } if (Input.mousePosition.x < 10 && camera.transform.position.x > 0) { camera.transform.Translate(-moveSpeed * Time.deltaTime, 0, 0); } if (Input.GetMouseButtonUp(0)) { Ray ray = camera.ScreenPointToRay(Input.mousePosition); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit)) { dotStatus = hit.transform.GetComponent <DotStatus> (); if (hit.collider.tag.Contains("Point") && dotStatus.isStand == false) { dotStatus.ChangeStatus(); Instantiate(dot, hit.transform.position, Quaternion.identity, hit.transform); Debug.Log("dot"); counter++; text.text = counter.ToString(); } if (hit.collider.tag.Contains("Dot") && dotStatus.isAdded == false) { dotStatus.isAdded = true; Debug.Log("tyta"); controller.AddToArray(hit.transform.gameObject); } } } }
public void ChangeStatus(DotStatus status) { currentStatus = status; GetComponent <ColorController>().ChangeMaterial(currentStatus); }
void LoadState() { string[] dotStatus = GameLoadSave.GetMapDotState(transform.name).Split(new char[] {','}); if (dotStatus[0].Equals("none")) return; switch (dotStatus[0]) { case "PlayerPowered" : currentStatus = DotStatus.PlayerPowered; break; case "PlayerUnpowered" : currentStatus = DotStatus.PlayerUnpowered; break; case "EnemyPowered" : currentStatus = DotStatus.EnemyPowered; break; case "EnemyUnpowered" : currentStatus = DotStatus.EnemyUnpowered; break; case "Depot" : currentStatus = DotStatus.Depot; break; case "Hacked" : currentStatus = DotStatus.Hacked; break; case "None" : currentStatus = DotStatus.None; break; } hackedTime = int.Parse(dotStatus[1]); print ("setting " + transform.name + " to " + currentStatus); foreach (MapLine line in connectedLines) { line.UpdateLine(); } }
public void UnHack() { currentStatus = DotStatus.None; foreach (MapLine line in connectedLines) line.SetOwners(); mapControl.PowerDots(); SaveState(); }
public void SetAsPlayerBase() { renderer.material.mainTexture = baseDotTexture; isPlayerBase = true; currentStatus = DotStatus.PlayerPowered; timer = 0.0f; }
public void SetAsHacked() { hackedTime = 3; currentStatus = DotStatus.Hacked; timer = 0.0f; foreach (MapLine line in connectedLines) line.SetOwners(); UnSelect(); SaveState(); }
public void SetAsEnemyBase() { renderer.material.mainTexture = baseDotTexture; isEnemyBase = true; currentStatus = DotStatus.EnemyPowered; timer = 0.0f; }
public void SetAsDepot() { currentStatus = DotStatus.Depot; timer = 0.0f; }
public void Release() { currentStatus = DotStatus.None; }
public void PowerUp() { if (currentStatus == DotStatus.PlayerUnpowered) { currentStatus = DotStatus.PlayerPowered; Instantiate(greenPowerUpFX, transform.position, Quaternion.identity); } if (currentStatus == DotStatus.EnemyUnpowered) { currentStatus = DotStatus.EnemyPowered; Instantiate(redPowerUpFX, transform.position, Quaternion.identity); } timer = 0.0f; }
public void PowerDown() { CanBeCaptured(false); if (currentStatus == DotStatus.PlayerPowered) currentStatus = DotStatus.PlayerUnpowered; if (currentStatus == DotStatus.EnemyPowered) currentStatus = DotStatus.EnemyUnpowered; timer = 0.0f; foreach (MapLine line in connectedLines) line.SetOwners(); }
private void ChangeDotStatus(Dot dot, DotStatus status) { dot.status = status; Window?.PaintDot(dot, status); }