public void Enter(Unit unit) { CurrentUnit = unit; team = CurrentUnit.Team; hexState = HexState.Untraversable; }
public void Exit() { CurrentUnit = null; hexState = HexState.Traversable; team = TEAM.neutral; }
private int valueToInt(SimpleJSON.JSONNode node, string key, HexState hexState = HexState.NONE) { if (node[key] == null) { IsValidMainStats = false; return(-1); } else { string result = node[key]; if (hexState == HexState.FIRST) { string firstDigit = result.Substring(0, 1); string remainder = result.Substring(1, result.Length - 1); int first = HexToInt(firstDigit) * 100000; return(int.Parse(remainder) + first); } else if (hexState == HexState.LEVEL) { bool hasLetter = result.Any(x => char.IsLetter(x)); if (hasLetter) { return(HexToInt(result)); //will give "garbage" number } else { return(int.Parse(result)); } } else //hexState == HexState.None { return(int.Parse(result)); } } }
private void MoveEndedB() { state = HexState.Idle; bool isThereAnyMatch = boardManager.RefreshMatchingHexes(); if (!isThereAnyMatch) { //DONT Increment gameManager.movementCount if (gameManager.rotationCount < 3) { if (gameManager.lastRotationDirection) { gameManager.OnClockWiseSwipe(); } else { gameManager.OnCounterClockWiseSwipe(); } } } else { gameManager.rotationCount = 3; gameManager.IncrementMovementCount(); foreach (BombBehaviour bb in boardManager.bombsReferences) { bb.DecrementCountDown(); } } }
private void setIdle() { hexStatusState = HexState.Dead; hexProgressState = HexProgress.Nothing; waterBalance = 0; temperatureBalance = 0; disasterProgress = 0; disasterState = DisasterState.None; }
private HexState[] CreateHexStates() { HexState[] ret = new HexState[_hexCount]; for (int i = 0; i < _hexCount; i++) { ret[i] = new HexState(); } return(ret); }
public void UpdateWith(HexState other) { this.visible = other.visible; if (!String.IsNullOrEmpty(other.terrain)) { this.terrain = other.terrain; } }
private void setIdle(HexState newHexState) { this.hexStatusState = newHexState; hexProgressState = HexProgress.Birth; waterBalance = 0; temperatureBalance = 0; disasterProgress = 0; disasterState = DisasterState.None; }
public void Move(float[] points) { float y = points[Random.Range(0, points.Length)]; state = y == 0 ? HexState.NONE : (y == -3 ? HexState.DOWN : HexState.UP); endPosition = new Vector3(transform.position.x, y, transform.position.z); if (transform != null) { transform?.DOMove(endPosition, 0.5f); } }
public BasicHexModel() { temperatureBalance = 0; waterBalance = 0; deltaTemperature = 0; deltaWater = 0; progressPoints = 0; state = HexState.Dead; health = 100; hexProgressState = ProgressState.Nothing; }
public void ResetAll() { temperatureBalance = 0; waterBalance = 0; deltaTemperature = 0; deltaWater = 0; progressPoints = 0; health = 0; state = HexState.Dead; hexProgressState = ProgressState.Nothing; }
public void SetHexState(HexState a_hexSate, Color a_colour) { hexState = a_hexSate; if (!highlight) { highlight = GetComponentsInChildren <SpriteRenderer>()[1]; } highlight.color = a_colour; }
private void Update() { HexState hexState = GetHoveredState(); UpdateHexStates(hexState); SetBufferData(); MapTesterMat.SetTexture("_MainTex", _set.BaseMap); MapTesterMat.SetTexture("_BorderTex", _set.BorderMap); MapTesterMat.SetBuffer("_NeighborsBuffer", _neighborsBuffer); MapTesterMat.SetBuffer("_HexStates", _hexStatesBuffer); }
private IEnumerator Move() { state = HexState.Falling; moveT = 0.0f; while (transform.position != targetPosition) { transform.position = Vector3.Lerp(transform.position, targetPosition, moveT); moveT += Time.deltaTime / moveTime; yield return(waitForEndOfFrame);//new WaitForEndOfFrame(); } MoveEnded(); }
private void SetBufferData() { HexBufferState[] data = new HexBufferState[_hexCount]; for (int i = 0; i < _hexCount; i++) { HexState source = _hexStates[i]; data[i] = new HexBufferState() { Hover = source.Hover, Clicked = source.Clicked ? 1 : 0 }; } _hexStatesBuffer.SetData(data); }
private void UpdateHexStates(HexState hoveredState) { bool clicked = Input.GetMouseButtonDown(0); foreach (HexState state in _hexStates) { float target = state == hoveredState ? 1f : 0; state.Hover = Mathf.Lerp(target, state.Hover, _main.SelectionTestHoverSpeed); if (clicked && state == hoveredState) { state.Clicked = !state.Clicked; } } }
// Start is called before the first frame update void Start() { Neighbours = new Dictionary <NeighbourDirection, GameObject>(); HexState = HexState.Neutral; //for (int i = 0; i < Enum.GetValues(typeof(NeighbourDirection)).Length; i++) { // Vector3 direction = transform.TransformDirection(Vector3.back) * 5; // if (Physics.Raycast(transform.position, direction, out var hit, 20)) { // Debug.Log("Hit: " + hit.collider.name); // } //} //Debug.Log(Neighbours.Count); }
public static void InitMap(MapState mapState) { instance.tilemap.ClearAllTiles(); foreach (Vector3Int coord in mapState.Coordinates()) { HexState hex = mapState.GetHexState(coord); if (!hex.visible) { instance.tilemap.SetTile(coord, instance.blackTile); } else if (hex.terrain.Equals("GRASS")) { instance.tilemap.SetTile(coord, instance.grassTile); } else { instance.tilemap.SetTile(coord, instance.waterTile); } } Debug.Log("Map initialized"); }
public void Update() { HexState hexState = GetHoveredState(); UpdateHexStates(hexState); SetBufferData(); _main.SelectionTestMat.SetBuffer("_DistortionData", _main.DistortionOutput); _main.SelectionTestMat.SetFloat("_SourceImageWidth", _main.BaseTexture.width); _main.SelectionTestMat.SetFloat("_SourceImageHeight", _main.BaseTexture.height); _main.SelectionTestMat.SetTexture("_MainTex", _main.BaseTexture); _main.SelectionTestMat.SetBuffer("_HexStates", _hexStatesBuffer); _main.SelectionTestMat.SetFloat("_BorderThickness", _main.BorderThickness); _main.SelectionTestMat.SetBuffer("_CornersData", _main.CornerPointsBuffer); _main.SelectionTestMat.SetBuffer("_NeighborsBuffer", _main.NeighborsBuffer); _main.SelectionTestMat.SetFloat("_MaxIndex", _main.MaxIndex); if (_main.DrawCornerDebugLines) { DrawCorners(); } }
public void MakeMeActive() { battaleState = HexState.active; }
public void MakeMeActive()// establece el estado activo en este hexagono { battleHexState = HexState.active; }
public HexState(HexState state) { _terrain = state._terrain; _elevation = state._elevation; _unit = new UnitState(state._unit); }
private void MoveEnded() { state = HexState.Idle; bool isThereAnyMatch = boardManager.RefreshMatchingHexes(); }
// Setter to change state (Dead or Alive) public void SetState(HexState newState) { state = newState; }
public void MakeMeActive()//sets active state to this hex { battleHexState = HexState.active; }
private void DoRay() { RaycastHit hitInfo; if (fwdLastMove) { Vector3 fwdDir = transform.forward - transform.up; Debug.DrawRay(transform.position, fwdDir, Color.red); if (Physics.Raycast(transform.position, fwdDir, out hitInfo, 5)) { targetState = hitInfo.transform.gameObject.GetComponent <HexState>(); targetHexElevation = targetState.elevation; //TODO // serialisable movementRules [] = {up, down} // for each m in movementRules // run the if statement below // if(movementRules == targetHexElevation) {canMove = true} if (targetHexElevation == HexState.ElevationState.neut) //if elevation in HexState.class is neut { canMove = true; } else { canMove = false; } } else { canMove = false; } } else { Vector3 bckDir = -transform.forward - transform.up; Debug.DrawRay(transform.position, bckDir, Color.red); if (Physics.Raycast(transform.position, bckDir, out hitInfo, 5)) { targetState = hitInfo.transform.gameObject.GetComponent <HexState>(); targetHexElevation = targetState.elevation; if (targetHexElevation == HexState.ElevationState.neut) //if elevation in HexState.class is neut { canMove = true; } else { canMove = false; } } else { canMove = false; } } //if (targetHexElevation == HexState.ElevationState.down || targetHexElevation == HexState.ElevationState.neut) //{ // canRaise = true; //} //else if (targetHexElevation == HexState.ElevationState.up || targetHexElevation == HexState.ElevationState.neut) //{ // canLower = true; //} }
public void MakeActive() { battleHexState = HexState.active; }
public void SetHexState(Vector3Int position, HexState hex) { hexes[position.x + "," + position.y] = hex; }