Exemplo n.º 1
0
    public static void End(ELogType log_type, string time_check_name)
    {
        int elapsed_time = Environment.TickCount - check_start_time;

        object[] arg = { time_check_name, elapsed_time, ID };
        CDebugLog.LogFormat(log_type, "{0} elapsed_time = {1}ms [ID:{2}]", arg);
    }
Exemplo n.º 2
0
    protected void Update()
    {
        if (EventFrames.Length == 0)
        {
            return;
        }

        if (bPlayingAni)
        {
            float CurTime  = Time.time - AniStartTime;
            int   CurFrame = (int)(CurTime * EventFrames.Length / AllAniTime);
            if (CurFrame < EventFrames.Length)
            {
                // 프레임 이벤트 중복 체크
                if (CurFrame != PreFrame)
                {
                    for (int i = PreFrame + 1; i <= CurFrame; ++i)
                    {
                        FrameEvent(i);
                    }

                    PreFrame = CurFrame;

                    string   str  = "CurFrame{0} CurTime{1}";
                    object[] args = { CurFrame, CurTime };
                    CDebugLog.LogFormat(ELogType.Animation, str, args);
                }

                if (CurFrame < Sprites.Length)
                {
                    if (Sprites[CurFrame] != null)
                    {
                        spriteRenderer.sprite = Sprites[CurFrame];
                    }
                }
                if (CurFrame < SpritesAngles.Length)
                {
                    float      Angle       = CharRotateAngle == -1.0f ? SpritesAngles[CurFrame] : CharRotateAngle == 0.0f ? -SpritesAngles[CurFrame] : SpritesAngles[CurFrame];
                    Vector3    eulerAngles = new Vector3(0.0f, 0.0f, Angle);
                    Quaternion newRotation = Quaternion.Euler(eulerAngles);
                    gameObject.transform.rotation = newRotation;
                }
            }
            else
            {
                if (bLoopAni)
                {
                    AniStartTime = Time.time;
                }
                else
                {
                    bPlayingAni           = false;
                    spriteRenderer.sprite = null;

                    if (EState.Die == Character.curState)
                    {
                        Character.DestroyCharacter();
                    }
                    else
                    {
                        Character.Idle();
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    public void OnMakeWayPoints()
    {
        WayPoints.Clear();
        for (int i = 0; i < TileFullSize; ++i)
        {
            if (Tiles[i])
            {
                int a = i + Size - 1;
                if (0 <= a)
                {
                    if (a < Tiles.Length && Tiles[a] == false &&
                        a + 1 < Tiles.Length && Tiles[a + 1] == false &&
                        a - Size < Tiles.Length && Tiles[a - Size] == false)
                    {
                        if (WayPoints.Contains(a))
                        {
                            string   str = "WayPoint Same Index : {0}";
                            object[] arg = { a };
                            CDebugLog.LogFormat(ELogType.MapGenerator, str, arg);
                        }
                        else
                        {
                            WayPoints.Add(a);
                        }
                    }
                }

                int b = i + Size + 1;
                if (0 <= b)
                {
                    if (b < Tiles.Length && Tiles[b] == false &&
                        b - 1 < Tiles.Length && Tiles[b - 1] == false &&
                        b - Size < Tiles.Length && Tiles[b - Size] == false)
                    {
                        if (WayPoints.Contains(b))
                        {
                            string   str = "WayPoint Same Index : {0}";
                            object[] arg = { b };
                            CDebugLog.LogFormat(ELogType.MapGenerator, str, arg);
                        }
                        else
                        {
                            WayPoints.Add(b);
                        }
                    }
                }

                int c = i - Size - 1;
                if (0 <= c)
                {
                    if (c < Tiles.Length && Tiles[c] == false &&
                        c + 1 < Tiles.Length && Tiles[c + 1] == false &&
                        c + Size < Tiles.Length && Tiles[c + Size] == false)
                    {
                        if (WayPoints.Contains(c))
                        {
                            string   str = "WayPoint Same Index : {0}";
                            object[] arg = { c };
                            CDebugLog.LogFormat(ELogType.MapGenerator, str, arg);
                        }
                        else
                        {
                            WayPoints.Add(c);
                        }
                    }
                }

                int d = i - Size + 1;
                if (0 <= d)
                {
                    if (d < Tiles.Length && Tiles[d] == false && 0 < d - 1 &&
                        d - 1 < Tiles.Length && Tiles[d - 1] == false &&
                        d + Size < Tiles.Length && Tiles[d + Size] == false)
                    {
                        if (WayPoints.Contains(d))
                        {
                            string   str = "WayPoint Same Index : {0}";
                            object[] arg = { d };
                            CDebugLog.LogFormat(ELogType.MapGenerator, str, arg);
                        }
                        else
                        {
                            WayPoints.Add(d);
                        }
                    }
                }
            }
        }
        ShowWayPoints();
    }
Exemplo n.º 4
0
    private void Update()
    {
        Vector3 startPos = new Vector3();
        float   AxisX    = Input.GetAxis("JoystickAxisX");
        float   AxisY    = Input.GetAxis("JoystickAxisY");

        float AxisXRight = Input.GetAxis("JoystickAxisXRight");
        float AxisYRight = Input.GetAxis("JoystickAxisYRight");

        if (-0.5f < AxisX && AxisX < 0.5f)
        {
            AxisX = 0.0f;
        }
        else
        {
            AxisX = 0 < AxisX ? 1.0f : -1.0f;
        }

        if (-0.5f < AxisY && AxisY < 0.5f)
        {
            AxisY = 0.0f;
        }
        else
        {
            AxisY = 0 < AxisY ? 1.0f : -1.0f;
        }

        startPos.x = AxisX;
        startPos.y = AxisY;

        if (0.0f < startPos.x || 0.0f < startPos.y)
        {
            CachedMovePos = startPos;
        }

        Vector3 EndPos = gameObject.transform.position + startPos;

        Character.Move(EndPos);

        if (-0.5f < AxisXRight && AxisXRight < 0.5f)
        {
            AxisXRight = 0.0f;
        }
        else
        {
            AxisXRight = 0 < AxisXRight ? 0.3f : -0.3f;
        }

        if (-0.5f < AxisYRight && AxisYRight < 0.5f)
        {
            AxisYRight = 0.0f;
        }
        else
        {
            AxisYRight = 0 < AxisYRight ? 0.3f : -0.3f;
        }

        string str = "Axis {0}  {1}  {2}  {3}";

        object[] param = { AxisX, AxisY, AxisXRight, AxisYRight };
        CDebugLog.LogFormat(ELogType.Default, str, param);

        Vector3   CameraPos = new Vector3(AxisXRight, AxisYRight);
        Transform transform = Camera.main.transform;
        Vector3   position  = transform.position;

        position += CameraPos;
        Camera.main.transform.position = position;

        if (Character.curState == EState.Die)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.JoystickButton3))
        {
            Character.Attack1();
        }
        if (Input.GetKeyDown(KeyCode.JoystickButton2))
        {
            Character.Attack2();
        }
        if (Input.GetKeyDown(KeyCode.JoystickButton1))
        {
            Character.Skill();
        }
        if (Input.GetKeyDown(KeyCode.JoystickButton0))
        {
            Character.Dodge(CachedMovePos);
        }
    }