/// <summary>
    /// Returns the shooting direction.
    /// </summary>
    /// <param name='obj'>
    /// Object.
    /// </param>
    override protected Vector3 GetDirection(GameObject obj, ActionData data)
    {
        float   hitT;
        Vector3 mousePos  = data.mousePos == Vector3.zero ? PickUtil.GetXZPlaneHitPoint(out hitT) : data.mousePos;
        Vector3 direction = mousePos - obj.transform.position;

        direction.y = 0;
        direction.Normalize();
        return(direction);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Returns the position for the shot to start at.
    /// </summary>
    override protected Vector3 GetPosition(GameObject obj, Vector3 shotDirection, ActionData data)
    {
        float   hitT;
        Vector3 mousePos = data.mousePos == Vector3.zero ? PickUtil.GetXZPlaneHitPoint(out hitT) : data.mousePos;

        if (tileSize > 0)
        {
            mousePos = new Vector3((int)(mousePos.x / tileSize) * tileSize, 0, (int)(mousePos.z / tileSize) * tileSize);
        }
        return(mousePos);
    }