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
    // Use this for initialization
    new private void Start()
    {
        base.Start();

        CDebugLog.Log(ELogType.GameMode, "BattleGameMode Start");

        GameObject PlayerStart    = GameObject.FindGameObjectWithTag("PlayerStart");
        Vector3    PlayerPosition = PlayerStart.transform.position;

        PlayerPosition.z = 0.0f;
        GameObject PlayerObj = Instantiate <GameObject>(CResourceMgr.LoadCharacter(PlayerName, ECharacterType.Player), PlayerPosition, new Quaternion());

        Player = PlayerObj.GetComponent <CBaseCharacter>();
        Vector3 position = Camera.main.transform.position;

        position.x = PlayerPosition.x;
        position.y = PlayerPosition.y;
        Camera.main.transform.position = position;

        //GameObject Canvas = GameObject.FindGameObjectWithTag("Canvas");
        //GameObject BattleWidget = UIMgr.OpenUI(EUIType.BattleWidget);
        //GameObject InsBattleWidget = Instantiate(BattleWidget);
        //InsBattleWidget.transform.parent = Canvas.transform;
        //Debug.Log(BattleWidget);

        InitUIKeyEvent();

        GameObject FindObj = GameObject.Find("TouchInput");

        DefaultTouchInputPos = FindObj.transform.position;
    }
Exemplo n.º 3
0
    public void DestroyTileImage(object value)
    {
        CDebugLog.Log(ELogType.MapGenerator, "DestroyTileImage in MapGenerator");

        //Vector3 pos = (Vector3)value;
        //Tiles[Size * (int)pos.y + (int)pos.x] = false;
    }
Exemplo n.º 4
0
    // Use this for initialization
    new private void Start()
    {
        base.Start();

        CDebugLog.Log(ELogType.GameMode, "TestGameMode Start");

        GameObject PlayerStart    = GameObject.FindGameObjectWithTag("PlayerStart");
        Vector3    PlayerPosition = PlayerStart.transform.position;

        PlayerPosition.z = 0.0f;
        GameObject PlayerObj = Instantiate <GameObject>(CResourceMgr.LoadCharacter(player_name, ECharacterType.Player), PlayerPosition, new Quaternion());

        Player = PlayerObj.GetComponent <CBaseCharacter>();
        Vector3 position = Camera.main.transform.position;

        position.x = PlayerPosition.x;
        position.y = PlayerPosition.y;
        Camera.main.transform.position = position;

        InitUIKeyEvent();

        GameObject FindObj = GameObject.Find("TouchInput");

        DefaultTouchInputPos = FindObj.transform.position;
    }
Exemplo n.º 5
0
 private void Awake()
 {
     CDebugLog.Log(ELogType.GameMode, "MapToolMode Awake");
     Map.FileName  = FileName;
     Map.Size      = Size;
     Map.BlockRate = BlockRate;
 }
Exemplo n.º 6
0
    public void DestroyBlockImage(Vector3 pos)
    {
        CDebugLog.Log(ELogType.MapGenerator, "DestroyBlockImage in MapGenerator");

        //GameObject game_object = (GameObject)value;
        //Vector3 pos = game_object.transform.position;
        Tiles[Size * (int)pos.y + (int)pos.x] = false;
    }
Exemplo n.º 7
0
    private void Awake()
    {
        CDebugLog.Log(ELogType.GameMode, "TestGameMode Awake");
        Map.FileName = FileName;
        Map.OnAllLoad();

        CDebugLog.Log(ELogType.GameMode, "TestGameMode Map AllLoad");
    }
Exemplo n.º 8
0
    private void Awake()
    {
        CDebugLog.Log(ELogType.GameMode, "BattleGameMode Awake");
        Map.FileName        = FileName;
        CMapGenerator.bTool = false;
        Map.bShowAllTile    = false;
        Map.OnAllLoad();

        CDebugLog.Log(ELogType.GameMode, "BattleGameMode Map AllLoad");
    }
Exemplo n.º 9
0
    // Start is called before the first frame update
    private void Start()
    {
        CDebugLog.Log(ELogType.GameMode, "MapToolMode Start");

        CMapGenerator.bTool = true;
        Map.bShowAllTile    = true;

        Button FindButton = GameObject.Find("ReCreateTileBtn").GetComponent <Button>();

        FindButton.onClick.AddListener(() => OnReCreateTile());

        FindButton = GameObject.Find("UpdateTileBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnUpdateTile());

        FindButton = GameObject.Find("ChangeRandomSeedBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnChangeRandomSeed());

        FindButton = GameObject.Find("SaveBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnSave());

        FindButton = GameObject.Find("LoadBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnLoad());

        FindButton = GameObject.Find("RefreshMapObjectBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnRefreshMapObject());

        FindButton = GameObject.Find("MakeWayPointsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnMakeWayPoints());

        FindButton = GameObject.Find("SaveWayPointsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnSaveWayPoints());

        FindButton = GameObject.Find("LoadWayPointsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnLoadWayPoints());

        FindButton = GameObject.Find("BuildWayPointPathsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnBuildWayPointPaths());

        FindButton = GameObject.Find("SaveWayPointPathsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnSaveWayPointPaths());

        FindButton = GameObject.Find("LoadWayPointPathsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnLoadWayPointPaths());

        FindButton = GameObject.Find("FindPathFromWayPointPathsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnFindPathFromWayPointPaths());

        FindButton = GameObject.Find("FindPathFromNoWayPointPathsBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnFindPathFromNoWayPointPaths());

        FindButton = GameObject.Find("AllLoadBtn").GetComponent <Button>();
        FindButton.onClick.AddListener(() => OnAllLoad());
    }
Exemplo n.º 10
0
    public void OnButtonA()
    {
        if (Player == null)
        {
            return;
        }

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

        CDebugLog.Log(ELogType.Default, "OnButtonA");
        Player.Attack1();
    }
Exemplo n.º 11
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        if (tag == "PlayerCharacter" || tag == "EnemyCharacter")
        {
            CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D CMovingTrap");

            CBaseCharacter character = collision.gameObject.GetComponent <CBaseCharacter>();
            if (character.curState == EState.Dodge || character.curState == EState.Die)
            {
                return;
            }

            character.Hit(Damage, gameObject, HitMove, false, EHitAniType.Type1);
        }
    }
Exemplo n.º 12
0
    IEnumerator Fade()
    {
        //CDebugLog.Log(ELogType.Default, "Fade Function End");

        SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>();

        float i = 0;

        for (float f = 1f; f >= 0; f -= 0.1f)
        {
            Color c = render.color;
            c.a          = f;
            render.color = c;
            i            = f;
            CDebugLog.Log(ELogType.Default, i);
            yield return(new WaitForSeconds(.1f));
        }
    }
Exemplo n.º 13
0
    public override bool Hit(int inDamage, GameObject Attacker, float HitMove, bool bSturn, EHitAniType HitAniType)
    {
        CDebugLog.Log(ELogType.Character, "Hit EnemyCharacter");

        bool bHit = base.Hit(inDamage, Attacker, HitMove, bSturn, HitAniType);

        if (bHit)
        {
            if (curState == EState.Die)
            {
                SoundMgr.PlaySound("Die2", ESoundType.Motion);
            }
            else
            {
                SoundMgr.PlaySound("Digital_Sword", ESoundType.Motion);
            }
        }

        return(bHit);
    }
Exemplo n.º 14
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        if (tag == "PlayerCharacter" || tag == "EnemyCharacter")
        {
            CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D DownStairs");

            CBaseCharacter character = collision.gameObject.GetComponent <CBaseCharacter>();
            if (character.curState == EState.Dodge)
            {
                return;
            }
            if (character.IsTeleport())
            {
                character.Teleport(false);
                CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D DownStairs return");
                return;
            }


            GameObject[] find_objects = GameObject.FindGameObjectsWithTag("UpStairs");
            foreach (GameObject find_object in find_objects)
            {
                CUpStairs stairs = find_object.GetComponent <CUpStairs>();
                if (stairs.Index == LinkIndex)
                {
                    Vector3 NewPos = find_object.transform.position;
                    NewPos.z = 0.0f;
                    collision.gameObject.transform.position = NewPos;
                    character.Teleport(true);

                    CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D DownStairs teleport");
                    break;
                }
            }
        }
    }
Exemplo n.º 15
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);
        }
    }
Exemplo n.º 16
0
    public override ArrayList FindPaths(int StartPos, int InEndPos, int InID)
    {
        ArrayList Paths = new ArrayList();

        if (!IsValidPosIndex(StartPos) || !IsValidPosIndex(InEndPos))
        {
            return(Paths);
        }

        CTimeCheck.Start(InID);
        EndPos = InEndPos;

        ClosedList.Clear();
        OpenList.Clear();
        foreach (Tile tile in Tiles)
        {
            if (tile.bBlock)
            {
                ClosedList.Add(tile.Index);
            }

            tile.Reset();
        }

        ClosedList.Add(StartPos);
        int FindNextPath         = StartPos;
        int path_make_start_time = Environment.TickCount;

        while (true)
        {
            //if (100 <= Environment.TickCount - path_make_start_time)
            //    return Paths;

            ArrayList MakedOpenList = MakeOpenList(FindNextPath);

            if (OpenList.Count == 0)
            {
                CDebugLog.Log(ELogType.AStar, "OpenList.Count == 0");
            }

            //FindNextPath = FindNextPathIndex(ref MakedOpenList);
            ////FindNextPath = FindNextPathIndexFromOpenList();

            //if (-1 == FindNextPath)
            //{
            FindNextPath = FindNextPathIndexFromOpenList();
            //}

            if (-1 == FindNextPath)
            {
                CTimeCheck.End(ELogType.AStar, "Failed FindPaths");
                return(Paths);
            }

            if (FindNextPath == EndPos)
            {
                break;
            }

            OpenList.Remove(FindNextPath);
            ClosedList.Add(FindNextPath);
        }

        int path_index = EndPos;

        Paths.Add(EndPos);
        while (true)
        {
            if (path_index == StartPos)
            {
                break;
            }

            Paths.Add(((Tile)Tiles[path_index]).ParentTile);
            path_index = ((Tile)Tiles[path_index]).ParentTile;
        }
        Paths.Reverse();


        CTimeCheck.End(ELogType.AStar, "Success FindPaths");
        return(Paths);
    }
Exemplo n.º 17
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.º 18
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();
                    }
                }
            }
        }
    }