public void occupyVirtualPosition(Vector3 position, Transform occupant) { var p = Mathfx.Round(position); //Debug.Log( p ); getNode(p).obstruction = occupant; }
/* * bool changingAltitude = false; * public override void update() * { * base.update(); * if ( Input.GetKeyDown( KeyCode.LeftShift ) ) * { * if ( changingAltitude ) * return; * caster.StartCoroutine(changeAltitude()); * } * } * * IEnumerator changeAltitude() * { * //cancel(); * abilityContainer.cancelAll(); * changingAltitude = true; * var caa = new ChangeAltitudeAbility(); * caa.initData( caster , null ); * caa.setup(); * yield return JobManager.instance.StartCoroutine( caa.execute() ); * Debug.Log( "Caster is me? " + ( GameManager.selected == caster ) ); * //createTiles(); * abilityContainer.setupAll(); * changingAltitude = false; * } */ void createTiles() { var startPosition = Board.instance.getNode(caster.transform.position); var list = Board.instance.getNodesAsList(); moveField = pathfinder.GetField(startPosition, list, movementPoints); foreach (Node node in moveField) { if (node.position == Mathfx.Round(caster.transform.position)) { continue; } node.tile.subscribe(this); } }
void onMouseEnterTile(Tile tile) { transform.position = Mathfx.Round(tile.node.position); }
/// <summary> /// Gets the node at Vector3 position. This function automatically calls areCoordsValid() on the input. If you want faster access or know what you're doing, use getNodeUnsafely instead. /// </summary> /// <param name="v"></param> /// <returns>Node at position of Vector3</returns> public Node getNode(Vector3 v) { var vr = Mathfx.Round(v); return(getNode((int)vr.x, (int)vr.z)); }
public void clearVirtualPosition(Vector3 position) { var p = Mathfx.Round(position); getNode(p).obstruction = null; }