Example #1
0
    /// <summary>
    /// creates a handle in left axis. return the delta movement on the isometric wEst axis.
    /// </summary>
    /// <param name="isoPosition"></param> the isometric position of our object. Pass the transform.position component
    /// <returns></returns>
    float handleY(Vector3 pos)
    {
        GUI.SetNextControlName("y");
        Handles.color = new Color(1.0f, 1.0f, 1.0f, 0.75f);
        var dir   = Isometric.isoProjection(Isometric.vectorToIsoDirection(IsoDirection.West));
        var delta = Handles.Slider(pos, dir);
        var d     = delta - pos;

        var res = d.magnitude * ((Math.Sign(d.x) == Math.Sign(dir.x)) ? 1 : -1);

        return(res);
    }
 void forward()
 {
     if (canMoveForward())
     {
         inAction = true;
         var newPos = this.isoObj.Position + Isometric.vectorToIsoDirection(currentForwardDirection);
         positionInMap += Isometric.vectorToIsoDirection(currentForwardDirection);
         moveTo(newPos, (x) => EasingFunctions.QuadEaseOut(x, 0, 1, forwardSpeed), () => {
             inAction = false;
         }, 0, forwardSpeed);
     }
 }
Example #3
0
    /// <summary>
    /// creates a handle in Up axis. return the delta movement on the isometric up axis.
    /// </summary>
    /// <param name="isoPosition"></param> the isometric position of our object
    /// <returns></returns>
    float handleZ(Vector3 isoPosition)
    {
        GUI.SetNextControlName("z");
        Handles.color = new Color(1.0f, 0.0f, 0.0f, 0.75f);
        var dir   = Isometric.isoProjection(Isometric.vectorToIsoDirection(IsoDirection.Up));
        var delta = Handles.Slider(isoPosition, dir);
        var d     = delta - isoPosition;

        var res = d.magnitude * ((Math.Sign(d.y) == Math.Sign(dir.y)) ? 1 : -1);

        return(res);
    }
    private void jumpUp()
    {
        var finalNewPos = posInMapToWorldPos(positionInMap + Isometric.vectorToIsoDirection(currentForwardDirection) + Isometric.vectorToIsoDirection(IsoDirection.Up));
        var tempNewPos  = posInMapToWorldPos(positionInMap + Isometric.vectorToIsoDirection(currentForwardDirection) * 2 / 3f + Isometric.vectorToIsoDirection(IsoDirection.Up) * 4 / 3f);

        inAction = true;
        moveTo(tempNewPos, (x) => EasingFunctions.Linear(x, 0, 1, forwardSpeed * 2 / 3f), () => {
            moveTo(finalNewPos, (x) => EasingFunctions.Linear(x, 0, 1, forwardSpeed * 1 / 3f), () => {
                positionInMap = positionInMap + Isometric.vectorToIsoDirection(currentForwardDirection) + Isometric.vectorToIsoDirection(IsoDirection.Up);
                inAction      = false;
            }, 0, forwardSpeed * 1 / 3f);
        }, 0, forwardSpeed * 2 / 3f);
    }
Example #5
0
 new void Update()
 {
     translate(Isometric.vectorToIsoDirection(IsoDirection.North) * Input.GetAxis("Vertical") * Time.deltaTime * speed);
     translate(Isometric.vectorToIsoDirection(IsoDirection.East) * Input.GetAxis("Horizontal") * Time.deltaTime * speed);
 }
 void OnDrawGizmos()
 {
     Gizmos.color = Color.red;
     Gizmos.DrawRay(transform.position, Isometric.isoProjection(Isometric.vectorToIsoDirection(currentForwardDirection)));
 }
 Tile lowerFrontFloorTile()
 {
     return(map.getTile(positionInMap + Isometric.vectorToIsoDirection(currentForwardDirection) + Isometric.vectorToIsoDirection(IsoDirection.Down) * 2));
 }
 Tile topTile()
 {
     return(map.getTile(positionInMap + Isometric.vectorToIsoDirection(IsoDirection.Up)));
 }
 Tile topFrontTile()
 {
     return(map.getTile(positionInMap + Isometric.vectorToIsoDirection(currentForwardDirection) + Isometric.vectorToIsoDirection(IsoDirection.Up)));
 }