Exemplo n.º 1
0
    void Work_Move4()
    {
        Vector3 TargetPoint = TestObject.transform.position;

        int WantedMovDir = 0;

        if (MyWayPoint != null)
        {
            FindWayToPos(TargetPoint);
        }

        if (MyWayPoint != null && NextWayPoint != null)
        {
            if (MyWayPoint.Nexts.Contains(NextWayPoint))
            {
                if (NextWayPoint.Pos.x > Me.pos.x)
                {
                    WantedMovDir = 1;
                }
                else
                {
                    WantedMovDir = -1;
                }


                WayPoint.ReachType Reach = MyWayPoint.Reachs[MyWayPoint.Nexts.IndexOf(NextWayPoint)];

                if (MyWayPoint.CheckReached(Me))
                {
                    if (Reach == WayPoint.ReachType.Move)
                    {
                    }
                    if (Reach == WayPoint.ReachType.JumpUp)
                    {
                        //  WantedMovDir = 0;
                        Me.mov.F_DoJump(Vector3.up, 1f);
                    }
                    if (Reach == WayPoint.ReachType.JumpForward)
                    {
                        Me.mov.F_DoJump((Vector3.up + Vector3.right * WantedMoveDir).normalized, 0.8f);
                    }
                }
            }

            if (NextWayPoint.CheckReached(Me))
            {
                MyWayPoint = NextWayPoint;
                if (Way.Count > 0)
                {
                    NextWayPoint = Way[0];

                    Way.RemoveAt(0);
                }
            }
        }


        Me.mov.In_HorDir = WantedMovDir;
    }