Example #1
0
    public void occupyVirtualPosition(Vector3 position, Transform occupant)
    {
        var p = Mathfx.Round(position);

        //Debug.Log( p );
        getNode(p).obstruction = occupant;
    }
Example #2
0
    /*
     * 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);
        }
    }
Example #3
0
 void onMouseEnterTile(Tile tile)
 {
     transform.position = Mathfx.Round(tile.node.position);
 }
Example #4
0
    /// <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));
    }
Example #5
0
    public void clearVirtualPosition(Vector3 position)
    {
        var p = Mathfx.Round(position);

        getNode(p).obstruction = null;
    }