/// <summary> /// Pinta uma linha da arena /// </summary /// <param name="row">Número da linha</param> /// <param name="col">Número da coluna</param> /// <param name="dir">Direção da linha</param> public void PaintLine(int row, int col, DIRECTION dir) { Player player = GameManager.instance.GetPlayer(); int n = GameEngine.NUM_ROW_COL - 1; foreach (ArenaField field in fields) { if (dir.Equals(DIRECTION.horizontal) && field.row == row) { field.PaintMe(player, dir); FindObjectOfType <AudioManager>().Play("menubselect"); } else if (dir.Equals(DIRECTION.vertical) && field.column == col) { field.PaintMe(player, dir); } else if (dir.Equals(DIRECTION.diagonalP) && field.row == field.column) { field.PaintMe(player, dir); } else if (dir.Equals(DIRECTION.diagonalS) && (field.row + field.column == n)) { field.PaintMe(player, dir); } } }
private void CreatePart(ScrollablePart part) { GameObject partGO = GameObject.Instantiate(part.gameObject); PartController newPart = partGO.GetComponent <PartController>(); newPart.Init(); float nextPartPos; if (currentParts.Count > 0) { var lastPart = currentParts[currentParts.Count - 1]; nextPartPos = direction.Equals(DIRECTION.HORIZONTAL) ? lastPart.transform.position.x + newPart.bounds.x : lastPart.transform.position.y + newPart.bounds.y; } else { nextPartPos = direction.Equals(DIRECTION.HORIZONTAL) ? transform.position.x : transform.position.y; } partGO.transform.position = direction.Equals(DIRECTION.HORIZONTAL) ? new Vector3(nextPartPos, transform.position.y, transform.position.z): new Vector3(transform.position.x, nextPartPos, transform.position.z); partGO.transform.rotation = Quaternion.identity; currentParts.Add(newPart); }
public static bool areOpposingSides(this DIRECTION first, DIRECTION second) //Lol Brute Force "Logik" { return(first.Equals(DIRECTION.NORTH) && second.Equals(DIRECTION.SOUTH) || first.Equals(DIRECTION.SOUTH) && second.Equals(DIRECTION.NORTH) || first.Equals(DIRECTION.EAST) && second.Equals(DIRECTION.WEST) || first.Equals(DIRECTION.WEST) && second.Equals(DIRECTION.EAST)); }
void FixedUpdate() { if (direction.Equals(DIRECTION.RIGHT)) { _rigid2D.velocity = Vector2.right * speed * Time.smoothDeltaTime; } else { _rigid2D.velocity = Vector2.left * speed * Time.smoothDeltaTime; } }
void FixedUpdate() { if (_animator.isAnimationEnd) { if (_direction.Equals(DIRECTION.RIGHT)) { _rigid2D.velocity = speed * Time.smoothDeltaTime * Vector2.right; } else { _rigid2D.velocity = speed * Time.smoothDeltaTime * Vector2.left; } } }
public void Move(float speed, DIRECTION dir) { _moveVector = dir.Equals(DIRECTION.HORIZONTAL) ? new Vector3(speed, 0f, 0f) : new Vector3(0f, speed, 0f); transform.position = transform.position + _moveVector; }