コード例 #1
0
 public override void SetDefaultValue()
 {
     supportInside = true;
     supportSlider = true;
     filterMode    = FilterMode.None;
     xAxisIndexs   = new List <int>()
     {
         0
     };
     yAxisIndexs = new List <int>()
     {
     };
     showDataShadow      = true;
     showDetail          = false;
     zoomLock            = false;
     m_Bottom            = 10;
     m_Left              = 10;
     m_Right             = 10;
     m_Top               = 0.9f;
     rangeMode           = RangeMode.Percent;
     start               = 30;
     end                 = 70;
     m_Orient            = Orient.Horizonal;
     m_ScrollSensitivity = 10;
     m_LabelStyle        = new LabelStyle();
     m_LineStyle         = new LineStyle(LineStyle.Type.Solid)
     {
         opacity = 0.3f
     };
     m_AreaStyle = new AreaStyle()
     {
         show    = true,
         opacity = 0.3f
     };
 }
コード例 #2
0
 public virtual void Init(Vector3 pos, Orient dir)
 {
     transform.position         = pos;
     this.dir                   = dir;
     transform.localEulerAngles = new Vector3(0, dir == Orient.Left ? 180f : 0, 0);
     timer = TimerSvc.Ins;
 }
コード例 #3
0
ファイル: PolygonEx.cs プロジェクト: cs-util/GeometryEx
        /// <summary>
        /// Returns a new Polygon placed in a spatial relationship with a supplied polygon by using supplied Orient points derived from Polygon.Compass bounding box points on each Polygon.
        /// </summary>
        /// <param name="adjTo">Reference Polygon in relation to which to place This Polygon.</param>
        /// <param name="from">Orient value indicating the point on This Polygon to use a MoveFromTo 'from' value.</param>
        /// <param name="to">Orient value indicating the point on the reference Polygon as a MoveFromTo 'to' value.</param>
        /// <returns>A new Polygon.</returns>
        public static Polygon PlaceNear(this Polygon polygon, Polygon adjTo, Orient from, Orient to)
        {
            var thisCompass = polygon.Compass();
            var adjCompass  = adjTo.Compass();

            return(polygon.MoveFromTo(thisCompass.PointBy(from), adjCompass.PointBy(to)));
        }
コード例 #4
0
        /// <summary>
        /// Attempts to place a supplied Polygon in a position relative to another Polygon, using specified paired bounding box orientation points on each Polygon. Optionally restricts Polygon placement within a perimeter and/or avoiding intersection with a supplied list of Polygons.
        /// </summary>
        /// <param name="polygon">The Polygon to be placed adjacent to another Polygon.</param>
        /// <param name="oPolygon">The Polygon TopoBox orientation to use as an insertion point.</param>
        /// <param name="adjTo">The Polygon adjacent to which the new Polygon will be located.</param>
        /// <param name="oAdjTo">The Polygon TopoBox orientation to use as a placement point.</param>
        /// <param name="within">The Polygon that must cover the resulting Polygon.</param>
        /// <param name="among">The collection of Polygons that must not intersect the resulting Polygon.</param>
        /// <param name="rotateToFit">Boolean indicating whether the Polygon should be rotated to fit.</param>
        /// <returns>
        ///  A new Polygon or null if the conditions of placement cannot be satisfied.
        /// </returns>
        public static Polygon ByOrient(Polygon polygon,
                                       Orient oPolygon,
                                       Polygon adjTo,
                                       Orient oAdjTo,
                                       Polygon within        = null,
                                       IList <Polygon> among = null,
                                       bool rotateToFit      = false)
        {
            var tryPolygon = polygon.MoveFromTo(polygon.Box().PointBy(oPolygon), adjTo.Box().PointBy(oAdjTo));

            if (tryPolygon.Fits(within, among))
            {
                return(tryPolygon);
            }
            else if (rotateToFit)
            {
                var t = new Transform();
                t.Rotate(Vector3.ZAxis, 90);
                polygon    = t.OfPolygon(polygon);
                tryPolygon = polygon.MoveFromTo(polygon.Box().PointBy(oPolygon), adjTo.Box().PointBy(oAdjTo));
                if (tryPolygon.Fits(within, among))
                {
                    return(tryPolygon);
                }
            }
            return(null);
        }
コード例 #5
0
        private void UpdateContext(ParallelAxis axis)
        {
            var parallel = chart.GetChartComponent <ParallelCoord>(axis.parallelIndex);

            if (parallel == null)
            {
                return;
            }

            m_Orient   = parallel.orient;
            m_Parallel = parallel;
            var axisCount = chart.GetChartComponentNum <ParallelAxis>();

            if (m_Orient == Orient.Horizonal)
            {
                var each = axisCount > 1 ? parallel.context.height / (axisCount - 1) : 0;
                axis.context.x     = parallel.context.x;
                axis.context.y     = parallel.context.y + (axis.index) * each;
                axis.context.width = parallel.context.width;
            }
            else
            {
                var each = axisCount > 1 ? parallel.context.width / (axisCount - 1) : 0;
                axis.context.x     = parallel.context.x + (axis.index) * each;
                axis.context.y     = parallel.context.y;
                axis.context.width = parallel.context.height;
            }
            axis.context.orient   = m_Orient;
            axis.context.height   = 0;
            axis.context.position = new Vector3(axis.context.x, axis.context.y);
        }
コード例 #6
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AI_StateMachine_Helper helper = animator.GetComponent <AI_StateMachine_Helper>();
        Movement    movement          = helper.getMovement();
        AI_Movement aiMovement        = helper.getAIMovement();
        Orient      orient            = helper.getOrient();
        int         patrolIndex       = animator.GetInteger("PatrolLocationIndex");

        // Patrol if location available
        if (patrolIndex > 0)
        {
            Transform randomPatrolSpot = Navigation_manual.getPatrolLocation(patrolIndex);
            Vector2   visitPos         = randomPatrolSpot.position;
            orient.lookAtStep(visitPos);
            aiMovement.Move(visitPos);

            // Patrol point reach
            bool positionReached = movement.positionReached(visitPos);
            if (positionReached)
            {
                animator.SetTrigger("PatrolPointReached");
            }
        }
        else
        {
            Debug.LogWarning("Patrol location not found");
            animator.SetTrigger("PatrolPointReached");
        }
    }
コード例 #7
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AI_StateMachine_Helper helper = animator.GetComponent <AI_StateMachine_Helper>();
        Movement    movement          = helper.getMovement();
        AI_Movement aiMovement        = helper.getAIMovement();
        Orient      orient            = helper.getOrient();
        AI_Memory   aiMemory          = helper.getMemory();

        List <Memory> memoryCache = aiMemory.getMemoryCache();

        if (memoryCache.Count == 0)
        {
            Debug.LogWarning("flee target not found");
            return;
        }

        // Go to last combat location
        Vector2 lastSeenEnemyPos = memoryCache[0].lastSeenPosition;

        orient.lookAtStep(lastSeenEnemyPos);
        aiMovement.Move(lastSeenEnemyPos);

        // Combat point reach
        bool positionReached = movement.positionReached(lastSeenEnemyPos);

        if (positionReached)
        {
            memoryCache.RemoveAt(0);
            animator.SetTrigger("CombatPointReached");
        }
    }
コード例 #8
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AI_StateMachine_Helper helper = animator.GetComponent <AI_StateMachine_Helper>();
        Movement movement             = helper.getMovement();
        Orient   orient  = helper.getOrient();
        Vector2  thisPos = movement.getPosition();

        bool feelPain = animator.GetBool("FeelPain");

        //List<Vector2> locationMemory = helper.getMemory().getLocations();
        if (feelPain)
        {
            AI_Sense_Pain painRecepter  = helper.getPainRecepter();
            Vector2       painDirection = painRecepter.getLatestDamageDirection();
            Vector2       respondToDir  = thisPos + painDirection;
            orient.lookAtStep(respondToDir);
        }
        //else if(locationMemory.Count > 0)
        //{
        //    Vector2 targetLocation = locationMemory[locationMemory.Count - 1];
        //    orient.lookAtStep(targetLocation);

        //    //bool weaponized =
        //    //movement.Move(targetLocation - thisPos);
        //}
    }
コード例 #9
0
    public Orient Transform(Orient other)
    {
        var center   = other.Rotation * Center + other.Center;
        var rotation = other.Rotation * Rotation;

        return(new Orient(center, rotation));
    }
コード例 #10
0
    public void ComboAttack(Orient dir)
    {
        double nowAtTime = TimerSvc.Ins.GetNowTime();

        if (CurState == EnityState.Attack)
        {
            if (nowAtTime - lastAtTime < Constants.ComboInterval && lastAtTime != 0)
            {
                if (comboSkill[comboIndex] != comboSkill[comboSkill.Length - 1])
                {
                    Debug.Log("==========combo");
                    comboIndex += 1;
                    comboQue.Enqueue(comboSkill[comboIndex]);
                    lastAtTime = nowAtTime;
                }
                else
                {
                    lastAtTime = 0;
                    comboIndex = 0;
                }
            }
        }
        else if (CurState == EnityState.Idle)
        {
            lastAtTime = nowAtTime;
            comboIndex = 0;
            stateMgr.ChangeState(this, EnityState.Attack, comboSkill[comboIndex], dir);
        }
    }
コード例 #11
0
 public void SetDir(Orient dir)
 {
     if (controller.Dir != dir)
     {
         controller.Dir = dir;
     }
 }
コード例 #12
0
    public override void Init(Vector3 pos, Orient dir)
    {
        base.Init(pos, dir);
        var go = GameObject.FindGameObjectWithTag("CameraFollow");

        cameraFollow = go.GetComponent <CameraFollow>();
    }
コード例 #13
0
        public GameObject CreateCamera(TileNode loc, FramingType scale, Orient orient, Hangle hangle, Vangle vangle)
        {
            //Debug.Log(scale);
            GameObject camHost = new GameObject();
            //camHost.transform.position = loc.transform.position;
            var cva           = camHost.AddComponent <CinemachineVirtualCamera>();
            var cbod          = camHost.AddComponent <CinemachineCameraBody>();
            var cc            = cva.AddCinemachineComponent <CinemachineComposer>();
            var cbmcp         = cva.AddCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
            var camattributes = camHost.AddComponent <CamAttributesStruct>();

            camattributes.Set(scale, loc.transform.gameObject.name, orient, hangle, vangle);

            // composer parameters TODO: tweak via separate gameobject component structure
            cc.m_HorizontalDamping = 10;
            cc.m_VerticalDamping   = 10;
            cc.m_LookaheadTime     = 0.2f;
            cc.m_DeadZoneWidth     = 0.25f;
            cc.m_SoftZoneWidth     = 0.5f;

            var framing_data = FramingParameters.FramingTable[scale];

            // FStop
            cbod.IndexOfFStop = CinematographyAttributes.fStops[framing_data.DefaultFStop];
            // Lens
            cbod.IndexOfLens = CinematographyAttributes.lenses[framing_data.DefaultFocalLength];

            // set at planning time.
            //cbod.FocusTransform = target_go.transform;

            // create small amount of noise
            cbmcp = cva.AddCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
            cbmcp.m_NoiseProfile  = CinematographyAttributes.standardNoise;
            cbmcp.m_AmplitudeGain = 0.5f;
            cbmcp.m_FrequencyGain = 1f;

            // worldDirectionOf Camera relative to location transform
            var camTransformDirection = DegToVector3(camattributes.OrientInt + camattributes.HangleInt);

            // calculate where to put camera
            var fakeTarget = CreateFakeTarget(actors[0].gameObject, loc.transform);
            var camDist    = CinematographyAttributes.CalcCameraDistance(fakeTarget, scale);

            GameObject.DestroyImmediate(fakeTarget);
            cbod.FocusDistance = camDist;

            // Calculate Camera Position
            camHost.transform.position = loc.transform.position + camTransformDirection * camDist;
            var height = CinematographyAttributes.SolveForY(loc.transform.position, camHost.transform.position, 0.5f, camattributes.VangleInt);

            camHost.transform.position = new Vector3(camHost.transform.position.x, height, camHost.transform.position.z);

            // Gives starting orientation of camera. At planning time, a "lookAt" parameter is set to specific target.
            camHost.transform.rotation.SetLookRotation(loc.transform.position);

            // Set Name of camera object
            camHost.name = string.Format("{0}.{1}.{2}.{3}.{4}", loc.name, scale, camattributes.targetOrientation, camattributes.hangle, camattributes.vangle);
            return(camHost);
        }
コード例 #14
0
ファイル: CamSchema.cs プロジェクト: drwiner/UnityAI4Games
 public CamSchema(FramingType _scale, string _tLoc, Orient _tOrient, Hangle _hangle, Vangle _vangle)
 {
     scale             = _scale;
     targetLocation    = _tLoc;
     targetOrientation = _tOrient;
     hangle            = _hangle;
     vangle            = _vangle;
 }
コード例 #15
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //    Vector2 enemyPos = aiEnemyFinder.getClosestEnemy().position;
    //    Vector2 thisPos = movement.getPosition();
    //    movement.SetDirectionVector(thisPos - enemyPos);
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AI_StateMachine_Helper helper = animator.GetComponent <AI_StateMachine_Helper>();
        Movement    movement          = helper.getMovement();
        AI_Movement aiMovement        = helper.getAIMovement();
        Orient      orient            = helper.getOrient();
        AI_Memory   aiMemory          = helper.getMemory();
        Vector2     thisPos           = movement.getPosition();

        List <Memory> memoryCache = aiMemory.getMemoryCache();

        if (memoryCache.Count == 0)
        {
            Debug.LogWarning("flee target not found");
            return;
        }

        // Get closest
        Vector2 tmp               = memoryCache[0].lastSeenPosition;
        Vector2 enemyPos          = tmp;
        float   closestDistSqrTmp = (tmp - thisPos).sqrMagnitude;
        float   closestDistSqr    = closestDistSqrTmp;

        for (int i = 1; i < memoryCache.Count; i++)
        {
            tmp = memoryCache[i].lastSeenPosition;
            closestDistSqrTmp = (tmp - thisPos).sqrMagnitude;
            if (closestDistSqr > closestDistSqrTmp)
            {
                closestDistSqr = closestDistSqrTmp;
                enemyPos       = tmp;
            }
        }

        // Get hiding spot
        Transform hidingSpot = Navigation_manual.nearest_cover(thisPos, enemyPos);

        // Flee to hiding spot
        if (hidingSpot != null)
        {
            orient.lookAtStep(hidingSpot.position);
            aiMovement.Move(hidingSpot.position);

            // Combat point reach
            bool positionReached = movement.positionReached(hidingSpot.position);
            if (positionReached)
            {
                animator.SetTrigger("CoverPointReached");
            }
        }
        // Flee from enemy
        else
        {
            Vector2 moveDir = thisPos - enemyPos;
            orient.lookAtStep(enemyPos);
            movement.Move(moveDir);
        }
    }
コード例 #16
0
    public void Attack(Orient dir, int skillId)
    {
        if (controller.Dir != dir)
        {
            controller.Dir = dir;
        }

        stateMgr.ChangeState(this, EnityState.Attack, skillId, dir);
    }
コード例 #17
0
    private static void divide(ref int[,] maze, int x, int y, int width, int height, Orient o)
    {
        if (width < minWidth || height < minHeight)
        {
            return;
        }

        bool hori = (o == Orient.HORI);

        // Find wall drawing position
        int wx = x + (hori ? 0 : Random.Range(0, width - 2));
        int wy = y + (hori ? Random.Range(0, height - 2) : 0);

        // Find passage location
        int px = wx + (hori ? Random.Range(0, width) : 0);
        int py = wy + (hori ? 0 : Random.Range(0, height));

        // Direction of wall?
        int dx = (hori ? 1 : 0);
        int dy = (hori ? 0 : 1);

        // Length of wall
        int length = hori ? width : height;

        // Direction opposite to wall
        Dir d = hori ? Dir.S: Dir.E;

        for (int i = 0; i < length; i++)
        {
            if (wx != px || wy != py)
            {
                maze[wy, wx] = 1;
            }
            wx += dx;
            wy += dy;
        }

        int nx = x;
        int ny = y;

        int w = hori ? width : wx - x + 1;
        int h = hori ? wy - y + 1 : height;

        // Divide first half
        divide(ref maze, nx, ny, w, h, chooseOrient(w, h));

        nx = hori ? x : wx + 1;
        ny = hori ? wy + 1 : y;

        w = hori ? width : x + width - wx - 1;
        h = hori ? y + height - wy - 1 : height;
        divide(ref maze, nx, ny, w, h, chooseOrient(w, h));



        // Issue, need to adjust code for drawing walls rather than passages
    }
コード例 #18
0
    // Position new block as far as possible from existing blocks
    Orient FarthestLocation(IList <Orient> existing_blocks)
    {
        int   table_x       = 1400;                        // length of table in mm
        int   table_z       = 800;                         // width of table in mm
        int   padding_x_min = _pick_area_width + _padding; // extra padding to avoid pile of blocks
        int   padding_x_max = _padding;                    // padding
        int   padding_z_min = _padding;                    // padding
        int   padding_z_max = _padding;                    // padding
        float block_dist_min;                              // minimum distance between each point on table to nearest block
        float largest_dist = 0;                            // largest min distance out of all points on table
        float new_block_x  = 0;                            // x coordinate of new block
        float new_block_z  = 0;                            // z coordinate of new block
        float new_block_y  = _tileSize.y + 0.002f;         // y (height) of new block of bottom layer on table + tolerance

        for (int x = padding_x_min; x < table_x - padding_x_max; x++)
        {
            for (int z = padding_z_min; z < table_z - padding_z_max; z++)
            {
                block_dist_min = table_x + table_z; // distance has to be less than length + width of table
                foreach (var each_block in existing_blocks)
                {
                    // convert distance to meters
                    float dx   = (x * 0.001f) - each_block.Center.x;
                    float dz   = (z * 0.001f) - each_block.Center.z;
                    float dist = Mathf.Sqrt(dx * dx + dz * dz);
                    // get minimum distance to any block on table
                    if (dist < block_dist_min)
                    {
                        block_dist_min = dist;
                    }
                }
                // store largest minimum distance
                if (block_dist_min > largest_dist)
                {
                    largest_dist = block_dist_min;
                    new_block_x  = x * 0.001f;
                    new_block_z  = z * 0.001f;
                }
            }
        }
        // (a) get angle to point at previous block
        float prev_block_x = existing_blocks[existing_blocks.Count - 1].Center.x;
        float prev_block_z = existing_blocks[existing_blocks.Count - 1].Center.z;
        float angle_prev   = -Mathf.Rad2Deg * Mathf.Atan2(new_block_z - prev_block_z, new_block_x - prev_block_x);
        // Debug.Log(string.Format("dx = {0}, dz = {1}, angle = {2}", new_block_x - prev_block_x, new_block_z - prev_block_z, angle_prev));

        // position new block and add to list
        Vector3 position = new Vector3(new_block_x, new_block_y, new_block_z);
        // select which angle to use for new block (average or previous)
        float      angle     = angle_prev;
        Quaternion rotation  = Quaternion.Euler(0, angle, 0);
        Orient     new_block = new Orient(position, rotation);

        Debug.Log(string.Format("Block {0} location: {1:0.000}, {2:0.000}, {3:0.000}, {4:0}", existing_blocks.Count + 1, new_block_x, new_block_y, new_block_z, angle));
        return(new_block);
    }
コード例 #19
0
ファイル: CamSchema.cs プロジェクト: drwiner/GDPOPS
        public static int OrientToInt(Orient orient)
        {
            if (orient.Equals(Orient.None))
            {
                return(-1);
            }
            var theRest = orient.ToString().Split('o')[1];

            return(Int32.Parse(theRest));
        }
コード例 #20
0
ファイル: CamSchema.cs プロジェクト: drwiner/GDPOPS
 public CamSchema(FramingType _scale, string _tLoc, Orient _tOrient, Hangle _hangle, Vangle _vangle, float _distance, float _height)
 {
     scale             = _scale;
     targetLocation    = _tLoc;
     targetOrientation = _tOrient;
     hangle            = _hangle;
     vangle            = _vangle;
     distance          = _distance;
     height            = _height;
 }
コード例 #21
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        Orient orient = (Orient)target;

        if (GUILayout.Button("Orient Buildings"))
        {
            orient.OrientBuildings();
        }
    }
コード例 #22
0
 public void Copy(Legend legend)
 {
     m_Show = legend.show;
     m_Orient = legend.orient;
     m_Location.Copy(legend.location);
     m_ItemWidth = legend.itemWidth;
     m_ItemHeight = legend.itemHeight;
     m_ItemGap = legend.itemGap;
     m_ItemFontSize = legend.itemFontSize;
     m_Data.Clear();
     foreach (var d in legend.data) m_Data.Add(d);
 }
コード例 #23
0
ファイル: Shaper.cs プロジェクト: cs-util/GeometryEx
        /// <summary>
        /// Creates a rectilinear Polygon in the specified adjacent quadrant to the supplied Polygon's bounding box.
        /// </summary>
        /// <param name="area">Desired area of the new Polygon.</param>
        /// <param name="orient">Relative cardinal direction in which the new Polygon will be placed.</param>
        /// <returns>
        /// A new Polygon.
        /// </returns>
        public static Polygon AdjacentArea(Polygon polygon, double area, Orient orient)
        {
            if (polygon == null)
            {
                return(null);
            }
            var    box = new CompassBox(polygon);
            double sizeX;
            double sizeY = 0.0;

            if (orient == Orient.N || orient == Orient.S)
            {
                sizeX = box.SizeX;
                sizeY = area / box.SizeX;
            }
            else
            {
                sizeX = area / box.SizeY;
                sizeY = box.SizeY;
            }
            Vector3 origin = Vector3.Origin;

            switch (orient)
            {
            case Orient.N:
                origin = box.NW;
                break;

            case Orient.E:
                origin = box.SE;
                break;

            case Orient.S:
                origin = new Vector3(box.SW.X, box.SW.Y - sizeY);
                break;

            case Orient.W:
                origin = new Vector3(box.SW.X - sizeX, box.SW.Y);
                break;
            }
            return
                (new Polygon
                 (
                     new[]
            {
                origin,
                new Vector3(origin.X + sizeX, origin.Y),
                new Vector3(origin.X + sizeX, origin.Y + sizeY),
                new Vector3(origin.X, origin.Y + sizeY)
            }
                 ));
        }
コード例 #24
0
ファイル: MazeBulider.cs プロジェクト: guixun/Maze
    private Corridor RandomGetUseableCorridor(Orient orient)
    {
        List <int> useableIndex = new List <int>();

        orient = GetInvertQrient(orient);

        for (int i = 0; i < corridors.Length; i++)
        {
            bool useable = true;
            if (corridors[i].jointDir.ContainsKey(orient))
            {
                Tile[] tiles = corridors[i].jointDir[orient];
                foreach (Tile tile in tiles)
                {
                    Vector3Int pos = new Vector3Int(curPos.x + tile.x, 0, curPos.z + tile.z);
                    if (book.ContainsKey(pos))
                    {
                        useable = false;
                        break;
                    }
                }
            }
            else
            {
                useable = false;
            }

            if (useable)
            {
                useableIndex.Add(i);
            }
        }
#if Debug
        foreach (var item in useableIndex)
        {
            Debug.Log($"[Debug] Get useable corridor inex: <color=green><b>{item}</b></color>");
        }

        if (useableIndex.Count == 0 || useableIndex == null)
        {
            Debug.Log($"[Debug] <color=red><b>Can not find any useable corridor!</color></b>");
        }
#endif
        Corridor corridor = null;
        if (useableIndex.Count > 0)
        {
            corridor = corridors[useableIndex[Random.Range(0, useableIndex.Count)]];
        }

        return(corridor);
    }
コード例 #25
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AI_StateMachine_Helper helper = animator.GetComponent <AI_StateMachine_Helper>();
        Movement    movement          = helper.getMovement();
        AI_Movement aiMovement        = helper.getAIMovement();
        Orient      orient            = helper.getOrient();
        Equipment   equipment         = helper.getEquipment();
        AI_Finder   aiEnemyFinder     = helper.getEnemyFinder();
        Vector2     thisPos           = movement.getPosition();

        List <Transform> memoryCache = aiEnemyFinder.getSightCache();

        if (memoryCache.Count == 0)
        {
            Debug.LogWarning("attack target not found");
            return;
        }

        // Get closest
        Vector2 tmp               = memoryCache[0].position;
        Vector2 closestPos        = tmp;
        float   closestDistSqrTmp = (tmp - thisPos).sqrMagnitude;
        float   closestDistSqr    = closestDistSqrTmp;

        for (int i = 1; i < memoryCache.Count; i++)
        {
            tmp = memoryCache[i].position;
            closestDistSqrTmp = (tmp - thisPos).sqrMagnitude;
            if (closestDistSqr > closestDistSqrTmp)
            {
                closestDistSqr = closestDistSqrTmp;
                closestPos     = tmp;
            }
        }

        // Engage
        orient.lookAtStep(closestPos);
        aiMovement.Move(closestPos);

        // Attack when close
        AI_Weapon_Helper weaponAIHelper = equipment.getWeapon().GetComponent <AI_Weapon_Helper>();

        Assert.IsNotNull(weaponAIHelper);
        float meleeRange   = weaponAIHelper.getAttackRange();
        float enemyDistSqr = (closestPos - thisPos).sqrMagnitude;

        if (enemyDistSqr < meleeRange * meleeRange)
        {
            equipment.initPrimaryAttack();
        }
    }
コード例 #26
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AI_StateMachine_Helper helper = animator.GetComponent <AI_StateMachine_Helper>();
        Movement    movement          = helper.getMovement();
        AI_Movement aiMovement        = helper.getAIMovement();
        Orient      orient            = helper.getOrient();
        Equipment   equipment         = helper.getEquipment();
        AI_Finder   weaponFinder      = helper.getWeaponFinder();

        List <Transform> sightCache = weaponFinder.getSightCache();

        if (sightCache.Count == 0)
        {
            Debug.LogWarning("Weapon not found");
            return;
        }

        // Find closest weapon
        Vector2   thisPos           = movement.getPosition();
        Transform tmp               = sightCache[0];
        Transform weaponClosest     = tmp;
        float     closestDistSqrTmp = ((Vector2)tmp.position - thisPos).sqrMagnitude;
        float     closestDistSqr    = closestDistSqrTmp;

        for (int i = 1; i < sightCache.Count; i++)
        {
            tmp = sightCache[i];
            closestDistSqrTmp = ((Vector2)tmp.position - thisPos).sqrMagnitude;
            if (closestDistSqr > closestDistSqrTmp)
            {
                closestDistSqr = closestDistSqrTmp;
                weaponClosest  = tmp;
            }
        }

        // Move & Face enemy
        Vector2 enemyPos = weaponClosest.position;

        orient.lookAtStep(enemyPos);
        aiMovement.Move(enemyPos);

        // Fetch when close
        float pickupRadius = equipment.getPickUpRadius();
        float enemyDistSqr = (enemyPos - thisPos).sqrMagnitude;

        if (enemyDistSqr < pickupRadius * pickupRadius)
        {
            equipment.pickUp();
        }
    }
コード例 #27
0
        private void RenderAlignUI(GUIStyle sty, GUIStyle but)
        {
            if (!CheckVessel())
            {
                _flyByWire = false;
                Mode       = UIMode.SELECTED;
            }

            if (GUILayout.Button("Align Planes", but, GUILayout.ExpandWidth(true)))
            {
                Mode       = UIMode.SELECTED;
                _flyByWire = false;
            }

            GUILayout.Box("Time to AN : " + part.vessel.orbit.GetTimeToRelAN(FlightGlobals.Vessels[_selectedVesselIndex].orbit).ToString("F2"));
            GUILayout.Box("Time to DN : " + part.vessel.orbit.GetTimeToRelDN(FlightGlobals.Vessels[_selectedVesselIndex].orbit).ToString("F2"));
            GUILayout.Box("Relative Inclination :" + _relativeInclination.ToString("F2"));
            if (automation == true)
            {
                if (GUILayout.Button(_autoAlign ? "ALIGNING" : "Auto-Align", but, GUILayout.ExpandWidth(true)))
                {
                    _autoAlignBurnTriggered = false;
                    _autoAlign = !_autoAlign;
                }
            }
            if (_flyByWire == false)
            {
                if (GUILayout.Button("Orbit Normal", but, GUILayout.ExpandWidth(true)))
                {
                    _flyByWire = true;
                    PointAt    = Orient.Normal;
                }

                if (GUILayout.Button("Anti Normal", but, GUILayout.ExpandWidth(true)))
                {
                    _flyByWire = true;
                    PointAt    = Orient.AntiNormal;
                }
            }

            if (_flyByWire)
            {
                if (GUILayout.Button("Disable " + PointAt.ToString(), but, GUILayout.ExpandWidth(true)))
                {
                    FlightInputHandler.SetNeutralControls();
                    _flyByWire   = false;
                    _modeChanged = true;
                }
            }
        }
コード例 #28
0
ファイル: GridLine.cs プロジェクト: Biang2016/BiangBlock
 public void Initialize(Orient orient, Vector2 startPoint, float width, float length)
 {
     Trans.anchoredPosition = startPoint;
     if (orient == Orient.Horizontal)
     {
         Trans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, width);
         Trans.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, length);
     }
     else
     {
         Trans.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
         Trans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, length);
     }
 }
コード例 #29
0
 public void Copy(Legend legend)
 {
     m_Show         = legend.show;
     m_SelectedMode = legend.selectedMode;
     m_Orient       = legend.orient;
     m_Location.Copy(legend.location);
     m_ItemWidth   = legend.itemWidth;
     m_ItemHeight  = legend.itemHeight;
     m_ItemGap     = legend.itemGap;
     itemAutoColor = legend.itemAutoColor;
     m_TextStyle.Copy(legend.textStyle);
     ChartHelper.CopyList <string>(m_Data, legend.data);
     ChartHelper.CopyList <Sprite>(m_Icons, legend.icons);
 }
コード例 #30
0
    List <Orient> CreateRow(Orient orient, Vector3 center) //orient is the scanned brick's center
    {
        var allBlocks   = new List <Orient>();
        var radius      = Vector3.Distance(orient.Center, center);  //radius point oriented - center of orient
        var tileNumberf = (2 * Mathf.PI * radius) / (0.18f * 1.2f); //Number of Tile
        int tileNumber  = (int)Mathf.Floor(tileNumberf);

        for (int i = 1; i < tileNumber; i++)
        {
            var angle   = 360 / (float)tileNumber;
            var newTile = orient.RotateAround(center, i * angle); //newTile is the birck's center of new one
            allBlocks.Add(newTile);
        }
        return(allBlocks);
    }
コード例 #31
0
		private static bool CheckOrientation ()
		{
			Orient new_orient = GetScreenOrientation ();

			if (new_orient != current_orientation) {
				current_orientation = new_orient;

				if (OrientationChanged != null)
					OrientationChanged (null);

				Console.WriteLine ("Laptop orientation changed...");
			}

			return true;
		}
コード例 #32
0
        public HexComponent GetAdjacent(Orient myOar)
        {
            switch (myOar)
            {
                case Orient.n:
                    return n;
                case Orient.ne:
                    return ne;
                case Orient.se:
                    return se;
                case Orient.s:
                    return s;
                case Orient.sw:
                    return sw;
                case Orient.nw:
                    return nw;

                default:
                    return this;
            }
        }
コード例 #33
0
        public void MoveDirection(Orient myOar)
        {
            //Move one hexEntity in a direction
            switch (myOar)
            {
                case Orient.n:
                    if (hex.n != null)
                    {
                        if (!hex.n.HasUnit())
                        {
                            hex.n.SetUnit(this);
                            SetHex(hex.n);
                            hex.RemoveUnit();
                        }
                    }
                    break;
                case Orient.ne:
                    if (hex.ne != null)
                    {
                        if (!hex.ne.HasUnit())
                        {
                            hex.ne.SetUnit(this);
                            SetHex(hex.ne);
                            hex.RemoveUnit();
                        }
                    }
                    break;
                case Orient.se:
                    if (hex.se != null)
                    {
                        if (!hex.se.HasUnit())
                        {
                            hex.se.SetUnit(this);
                            SetHex(hex.se);
                            hex.RemoveUnit();
                        }
                    }
                    break;
                case Orient.s:
                    if (hex.s != null)
                    {
                        if (!hex.s.HasUnit())
                        {
                            hex.s.SetUnit(this);
                            SetHex(hex.s);
                            hex.RemoveUnit();
                        }
                    }
                    break;
                case Orient.sw:
                    if (hex.sw != null)
                    {
                        if (!hex.sw.HasUnit())
                        {
                            hex.sw.SetUnit(this);
                            SetHex(hex.sw);
                            hex.RemoveUnit();
                        }
                    }
                    break;
                case Orient.nw:
                    if (hex.nw != null)
                    {
                        if (!hex.nw.HasUnit())
                        {
                            hex.nw.SetUnit(this);
                            SetHex(hex.nw);
                            hex.RemoveUnit();
                        }
                    }
                    break;

                default:
                    //This should never happen
                    break;
            }
            AnimatedSpriteComponent sprite = _parent.GetDrawable("AnimatedSpriteComponent") as AnimatedSpriteComponent;
            SpriteComponent hexSprite = hex._parent.GetDrawable("SpriteComponent") as SpriteComponent;
            sprite.position = hexSprite.position;
        }
コード例 #34
0
ファイル: Accelerometer.cs プロジェクト: iainlane/f-spot
        private static bool CheckOrientation()
        {
            Orient new_orient = GetScreenOrientation ();

            if (new_orient != current_orientation) {
                current_orientation = new_orient;

                EventHandler eh = OrientationChanged;
                if (eh != null)
                    eh (null, EventArgs.Empty);

                Console.WriteLine ("Laptop orientation changed...");
            }

            return true;
        }
コード例 #35
0
 public void changeOrientation(Orient myOar)
 {
     orientation = myOar;
 }
コード例 #36
0
ファイル: Accelerometer.cs プロジェクト: GNOME/f-spot
        private static bool CheckOrientation()
        {
            Orient new_orient = GetScreenOrientation ();

            if (new_orient != CurrentOrientation) {
                CurrentOrientation = new_orient;

                EventHandler eh = OrientationChanged;
                if (eh != null)
                    eh (null, EventArgs.Empty);

                Log.Debug ("Laptop orientation changed...");
            }

            return true;
        }
コード例 #37
0
ファイル: RendezMe.cs プロジェクト: bengarney/RendezMe
    private void DriveShip(FlightCtrlState controls)
    {
        if(!CheckVessel())
            return;

        Vessel selectedVessel = FlightGlobals.Vessels[_selectedVesselIndex] as Vessel;

        if(_autoAlign)
        {
            // Is it time to burn? Find soonest node.
            double timeToBurnAN = vessel.orbit.GetTimeToRelAN(selectedVessel.orbit);
            double timeToBurnDN = vessel.orbit.GetTimeToRelDN(selectedVessel.orbit);

            bool ascendingSoonest = timeToBurnAN < timeToBurnDN;
            double timeToBurnNode = ascendingSoonest ? timeToBurnAN : timeToBurnDN;

            // Figure out which way we want to burn to adjust our inclination.
            _flyByWire = true;
            if(!_autoAlignBurnTriggered)
            {
                if (_relativeInclination < 0.0)
                    PointAt = ascendingSoonest ? Orient.Normal : Orient.AntiNormal;
                else
                    PointAt = ascendingSoonest ? Orient.AntiNormal : Orient.Normal;
            }

            // Do a burn just ahead of the ascending node - in the 5 seconds preceding.
            if ((timeToBurnNode < 10.0 || _autoAlignBurnTriggered) && _headingError.magnitude < 5.0 && Math.Abs(_relativeInclination) > 0.01)
            {
                _autoAlignBurnTriggered = true;
                if (Math.Abs(_relativeInclination) > 0.1)
                {
                    controls.mainThrottle = 1.0f;
                }
                else
                {
                    controls.mainThrottle = 0.25f;
                }
            }
            else
            {
                controls.mainThrottle = 0.0f;
            }

            if (Math.Abs(_relativeInclination) < 0.02)
            {
                _autoAlignBurnTriggered = false;
                _autoAlign = false;
            }
        }

        if (_autoPhaser)
        {
            switch(_autoPhaserState)
            {
                case AutoPhaserState.Step1WaitForTargetApsis:
                    double timeLeft = CalculateTimeTillNextTargetApsis();

                    // Set the PointAt based on who is faster at that point in time.
                    _flyByWire = true;
                    if (vessel.orbit.getOrbitalVelocityAt(timeLeft) > selectedVessel.orbit.getOrbitalVelocityAt(timeLeft))
                        PointAt = Orient.Retrograde;
                    else
                        PointAt = Orient.Prograde;

                    // Advance if it's time.
                    if (timeLeft < 5.0)
                    {
                        _autoPhaserState = AutoPhaserState.Step2BurnToMatchNextApsis;
                        _autoPhaserVelocityGoal = selectedVessel.orbit.getOrbitalVelocityAt(CalculateTimeTillFurtherTargetApsis());
                        _autoPhaseBurnComplete = false;
                    }
                    break;

                case AutoPhaserState.Step2BurnToMatchNextApsis:
                    double predictedVelocity = vessel.orbit.getOrbitalVelocityAt(CalculateTimeTillFurtherTargetApsis());
                    if (_headingError.magnitude < 5.0 && !_autoPhaseBurnComplete)
                    {
                        controls.mainThrottle = 1;
                    }
                    else
                    {
                        controls.mainThrottle = 0;
                    }

                    // Advance to next state if we hit our goal.
                    if (Math.Abs(predictedVelocity - _autoPhaserVelocityGoal) < 10)
                    {
                        _autoPhaseBurnComplete = true;
                        controls.mainThrottle = 0;

                    }

                    // Wait till we pass the apsis so we don't double advance.
                    if (_autoPhaseBurnComplete && CalculateTimeTillNextTargetApsis() > 10.0)
                        _autoPhaserState = AutoPhaserState.Step3WaitForTargetApsis;
                    break;

                case AutoPhaserState.Step3WaitForTargetApsis:
                    timeLeft = CalculateTimeTillNextTargetApsis();

                    // Set the PointAt based on who is faster at that point in time.
                    _flyByWire = true;
                    PointAt = Orient.Prograde;

                    // Advance if it's time.
                    if (timeLeft < 5.0)
                    {
                        _autoPhaserState = AutoPhaserState.Step4BurnToRendezvous;
                    }

                    break;

                case AutoPhaserState.Step4BurnToRendezvous:

                    // TODO: Make sure we are only considering the apsis that
                    // is spatially similar to ours, otherwise we get in sync
                    // orbitally but go into step 5 super far away.
                    double timeToRendezvous = 0.0, minDeltaT = 0.0;
                    CalculateNearestRendezvousInSeconds(out timeToRendezvous, out minDeltaT);

                    if (minDeltaT > 5)
                        controls.mainThrottle = 0.25f;
                    else
                    {
                        controls.mainThrottle = 0.0f;
                        _autoPhaserState = AutoPhaserState.Step5WaitForRendezvous;
                    }
                    break;

                case AutoPhaserState.Step5WaitForRendezvous:
                    timeToRendezvous = 0.0;
                    minDeltaT = 0.0;
                    CalculateNearestRendezvousInSeconds(out timeToRendezvous, out minDeltaT);

                    if(timeToRendezvous < 2)
                        _autoPhaserState = AutoPhaserState.Step6BurnToMatchVelocity;

                    break;

                case AutoPhaserState.Step6BurnToMatchVelocity:
                    if(_relativeVelocity.magnitude > 5)
                    {
                        _flyByWire = true;
                        PointAt = Orient.RelativeVelocityAway;

                        if(_headingError.magnitude < 5)
                        {
                            if (_relativeVelocity.magnitude > 15)
                                controls.mainThrottle = 1.0f;
                            else
                                controls.mainThrottle = 0.2f;
                        }

                    }
                    else
                    {
                        // All done!
                        controls.mainThrottle = 0.0f;
                        _autoPhaser = false;
                    }
                    break;

            }
        }

        if(_killRelativeVelocity)
        {
            controls.X = Mathf.Clamp(-_localRelativeVelocity.x * 8.0f, -1.0f, 1.0f);
            controls.Y = Mathf.Clamp(-_localRelativeVelocity.z * 8.0f, -1.0f, 1.0f);
            controls.Z = Mathf.Clamp(-_localRelativeVelocity.y * 8.0f, -1.0f, 1.0f);

            if (_localRelativeVelocity.magnitude < 0.1)
                _killRelativeVelocity = false;
        }
        else if (_homeOnRelativePosition)
        {
            Vector3 targetGoalPos = new Vector3(0.0f, 2.0f, 0.0f);
            targetGoalPos = selectedVessel.transform.localToWorldMatrix.MultiplyPoint(targetGoalPos);
            targetGoalPos = vessel.transform.worldToLocalMatrix.MultiplyPoint(targetGoalPos);

            Vector3 relPos = targetGoalPos;
            Vector4 goalVel = Vector3.zero;

            float velGoal = 0.1f;

            if (_targetDistance > 2.0f)
                velGoal = 0.3f;
            else if (_targetDistance > 10.0f)
                velGoal = 0.5f;
            else if (_targetDistance > 50.0f)
                velGoal = 1.0f;
            else if (_targetDistance > 150.0f)
                velGoal = 3.0f;

            if(Mathf.Abs(relPos.x) > 0.01f)
                goalVel.x = -Mathf.Sign(relPos.x) * velGoal;

            if (Mathf.Abs(relPos.y) > 0.01f)
                goalVel.y = -Mathf.Sign(relPos.y) * velGoal;

            if (Mathf.Abs(relPos.z) > 0.01f)
                goalVel.z = -Mathf.Sign(relPos.z) * velGoal;

            controls.X = Mathf.Clamp((goalVel.x - _localRelativeVelocity.x) * 8.0f, -1, 1);
            controls.Y = Mathf.Clamp((goalVel.z - _localRelativeVelocity.z) * 8.0f, -1, 1);
            controls.Z = Mathf.Clamp((goalVel.y - _localRelativeVelocity.y) * 8.0f, -1, 1);
        }

        if (!_flyByWire)
            return;

        Quaternion tgt = Quaternion.LookRotation(_tgtFwd, _tgtUp);
        Quaternion delta =
            Quaternion.Inverse(Quaternion.Euler(90, 0, 0) * Quaternion.Inverse(vessel.transform.rotation) * tgt);

        _headingError =
            new Vector3((delta.eulerAngles.x > 180) ? (delta.eulerAngles.x - 360.0F) : delta.eulerAngles.x,
                        (delta.eulerAngles.y > 180) ? (delta.eulerAngles.y - 360.0F) : delta.eulerAngles.y,
                        (delta.eulerAngles.z > 180) ? (delta.eulerAngles.z - 360.0F) : delta.eulerAngles.z) / 180.0F;
        _integral += _headingError * TimeWarp.fixedDeltaTime;
        _deriv = (_headingError - _prevErr) / TimeWarp.fixedDeltaTime;
        _act = Kp * _headingError + Ki * _integral + Kd * _deriv;
        _prevErr = _headingError;

        controls.pitch = Mathf.Clamp(controls.pitch + _act.x, -1.0F, 1.0F);
        controls.yaw = Mathf.Clamp(controls.yaw - _act.y, -1.0F, 1.0F);
        controls.roll = Mathf.Clamp(controls.roll + _act.z, -1.0F, 1.0F);
    }
コード例 #38
0
ファイル: RendezMe.cs プロジェクト: bengarney/RendezMe
    private void RenderAlignUI(GUIStyle sty)
    {
        if (!CheckVessel())
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        if (GUILayout.Button("Align Planes", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.SELECTED;
            _flyByWire = false;
        }

        GUILayout.Box("Time to AN : " +
                      vessel.orbit.GetTimeToRelAN(FlightGlobals.Vessels[_selectedVesselIndex].orbit).ToString("F2"));
        GUILayout.Box("Time to DN : " +
                      vessel.orbit.GetTimeToRelDN(FlightGlobals.Vessels[_selectedVesselIndex].orbit).ToString("F2"));
        GUILayout.Box("Relative Inclination :" + _relativeInclination.ToString("F2"));

        if(GUILayout.Button(_autoAlign ? "ALIGNING" : "Auto-Align", sty, GUILayout.ExpandWidth(true)))
        {
            _autoAlignBurnTriggered = false;
            _autoAlign = !_autoAlign;
        }

        if (_flyByWire == false)
        {
            if (GUILayout.Button("Orbit Normal", sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.Normal;
            }

            if (GUILayout.Button("Anti Normal", sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.AntiNormal;
            }
        }

        if (_flyByWire)
        {
            if (GUILayout.Button("Disable " + PointAt.ToString(), sty, GUILayout.ExpandWidth(true)))
            {
                FlightInputHandler.SetNeutralControls();
                _flyByWire = false;
                _modeChanged = true;
            }
        }
    }
コード例 #39
0
ファイル: RendezMe.cs プロジェクト: bengarney/RendezMe
    private void RenderRendezvousUI(GUIStyle sty)
    {
        if (!CheckVessel())
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        Vessel selectedVessel = FlightGlobals.Vessels[_selectedVesselIndex] as Vessel;

        //the above check should prevent a crash when the vessel we are looking for is destroyed
        //learn how to use list.exists etc...
        if (GUILayout.Button(selectedVessel.vesselName, sty, GUILayout.ExpandWidth(true)))
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        GUILayout.Box("Distance: " + _targetDistance.ToString("F1"), GUILayout.Width(300));
        GUILayout.Box("Rel Inc : " + _relativeInclination.ToString("F3"));
        GUILayout.Box("Rel VelM: " + _relativeVelocity.magnitude.ToString("F2"));

        // Take the relative velocity and project into ship local space.
        _localRelativeVelocity = vessel.transform.worldToLocalMatrix.MultiplyVector(_relativeVelocity);
        _localRelativePosition = vessel.transform.worldToLocalMatrix.MultiplyPoint(selectedVessel.transform.position);

        if(GUILayout.Button(_killRelativeVelocity == false ? "Kill Rel Vel" : "FIRING", sty, GUILayout.ExpandWidth(true)))
            _killRelativeVelocity = !_killRelativeVelocity;

        if (GUILayout.Button(_homeOnRelativePosition == false ? "Home on Y+ 5m" : "HOMING", sty, GUILayout.ExpandWidth(true)))
            _homeOnRelativePosition = !_homeOnRelativePosition;

        GUILayout.Box("Rel Vel : " + _localRelativeVelocity.x.ToString("F2") + ", " + _localRelativeVelocity.y.ToString("F2") + ", " + _localRelativeVelocity.z.ToString("F2"));
        GUILayout.Box("Rel Pos : " + _localRelativePosition.x.ToString("F2") + ", " + _localRelativePosition.y.ToString("F2") + ", " + _localRelativePosition.z.ToString("F2"));

        if (_flyByWire == false)
        {
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(ControlModeCaptions[0], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.RelativeVelocity;
                _modeChanged = true;
                _selectedFlyMode = 0;
            }

            if (GUILayout.Button(ControlModeCaptions[1], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.RelativeVelocityAway;
                _modeChanged = true;
                _selectedFlyMode = 1;
            }

            if (GUILayout.Button(ControlModeCaptions[2], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.Target;
                _modeChanged = true;
                _selectedFlyMode = 2;
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(ControlModeCaptions[3], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.TargetAway;
                _modeChanged = true;
                _selectedFlyMode = 3;
            }

            if (GUILayout.Button(ControlModeCaptions[4], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.MatchTarget;
                _modeChanged = true;
                _selectedFlyMode = 4;
            }

            if (GUILayout.Button(ControlModeCaptions[5], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.MatchTargetAway;
                _modeChanged = true;
                _selectedFlyMode = 5;
            }

            GUILayout.EndHorizontal();

        }

        if (_flyByWire)
        {
            if (GUILayout.Button("Disable " + ControlModeCaptions[_selectedFlyMode], sty, GUILayout.ExpandWidth(true)))
            {
                FlightInputHandler.SetNeutralControls();
                _flyByWire = false;
                _modeChanged = true;
            }
        }
    }