Пример #1
0
    public void SelectMap(GameObject map)       //action
    {
        Mapinfo M = GetSelectMap(map);

        moveTurn(M);                                           // map Move
        this.gameObject.GetComponent <CharacterGM> ().move(M); // character move
    }
Пример #2
0
    public void updateMap(EnemInfo C)
    {
        Mapinfo M = MGM.getmap(C.X, C.Y);

        if (M.Enemy_E.Contains(C.me))
        {
            M.Enemy_E.Remove(C.me);
        }
    }
Пример #3
0
    public void updateMap(Chainfo C)      // use to set map
    {
        Mapinfo M = MGM.getmap(C.X, C.Y);

        if (M.Character_C.Contains(C.me))
        {
            M.Character_C.Remove(C.me);
        }
    }
Пример #4
0
    public void Updatemove(Chainfo C)
    {
        Mapinfo M = MGM.getmap(C.X, C.Y);

        M.Character_C.Add(C.me);
        Vector3 V = M.gameObject.transform.position;

        C.gameObject.transform.position = V;
        C.Myposition = M;
    }
Пример #5
0
    public void Updatemove(EnemInfo E)
    {
        Mapinfo M = MGM.getmap(E.X, E.Y);

        M.Enemy_E.Add(E.me);
        Vector3 V = M.gameObject.transform.position;

        E.gameObject.transform.position = V;
        E.Myposition = M;
    }
Пример #6
0
    void MoveDelRoad(Mapinfo M)
    {
        List <Mapinfo> Top   = GetTopRow(M);
        List <Mapinfo> Down  = GetDownRow(M);
        List <Mapinfo> Left  = GetLeftRow(M);
        List <Mapinfo> Right = GetRightRow(M);

        if (Top.Count != 0)
        {
            for (int i = 0; i < Top.Count; i++)
            {
                if (i + 1 != Top.Count)
                {
                    Top [i].Type = Top [i + 1].Type;
                }
            }
            Top [Top.Count - 1].Type = RandomColor();
        }

        if (Down.Count != 0)
        {
            for (int i = Down.Count - 1; i >= 0; i--)
            {
                if (i - 1 >= 0)
                {
                    Down [i].Type = Down [i - 1].Type;
                }
            }
            Down [0].Type = RandomColor();
        }
        if (Left.Count != 0)
        {
            for (int i = Left.Count - 1; i >= 0; i--)
            {
                if (i - 1 >= 0)
                {
                    Left [i].Type = Left [i - 1].Type;
                }
            }
            Left [0].Type = RandomColor();
        }
        if (Right.Count != 0)
        {
            for (int i = 0; i < Right.Count; i++)
            {
                if (i + 1 != Right.Count)
                {
                    Right [i].Type = Right [i + 1].Type;
                }
            }
            Right [Right.Count - 1].Type = RandomColor();
        }
        updateColor();
    }
Пример #7
0
 public Mapinfo Getright(Mapinfo M)
 {
     if (CheckisOver(M.mapX + 1, M.mapY))
     {
         return(M);            //already down
     }
     else
     {
         return(Mapdata [M.mapX + 1, M.mapY]);
     }
 }
Пример #8
0
 public Mapinfo Getdown(Mapinfo M)
 {
     if (CheckisOver(M.mapX, M.mapY - 1))
     {
         return(M);            //already down
     }
     else
     {
         return(Mapdata [M.mapX, M.mapY - 1]);
     }
 }
Пример #9
0
 public Mapinfo Gettop(Mapinfo M)
 {
     if (CheckisOver(M.mapX, M.mapY + 1))
     {
         return(M);            //aleardy top
     }
     else
     {
         return(Mapdata [M.mapX, M.mapY + 1]);
     }
 }
Пример #10
0
    public List <Mapinfo> GetRightRow(Mapinfo M)
    {
        List <Mapinfo> Map = new List <Mapinfo>();

        foreach (Mapinfo map in Mapdata)
        {
            if (map.mapY == M.mapY && map.mapX > M.mapX && map != M)
            {
                Map.Add(map);
            }
        }
        return(Map);
    }
Пример #11
0
 public void characterJumpReturn(Character C)
 {
     foreach (Chainfo info in Cha_info)
     {
         if (info.me == C)
         {
             Mapinfo map = MGM.getmap(info.X, info.Y);
             map.Character_C.Remove(C);
             characterlist.Remove(C);
             info.me = null;
             info.gameObject.SetActive(false);
         }
     }
 }
Пример #12
0
    public void CreateCharacterOnMap(Enemy E_, Mapinfo M)
    {
        M.Enemy_E.Add(E_);
        Enemylist.Add(E_);
        string     number = E_.ID.ToString();
        Sprite     icon   = Resources.Load <Sprite> ("icon/Character_" + number);
        GameObject G      = Instantiate(OBJ_Character, Camera.transform);

        G.transform.position = new Vector3(M.transform.position.x, M.transform.position.y, 0.0f);
        G.AddComponent <EnemInfo> ();
        G.GetComponent <EnemInfo> ().Add(M.mapX, M.mapY, M, E_);
        Ene_info.Add(G.GetComponent <EnemInfo> ());
        Image Img = G.GetComponent <Image> ();

        Img.sprite = icon;
    }
Пример #13
0
    public Mapinfo getmap(int x, int y)
    {
        Mapinfo m = Mapdata [x, y];

        return(m);
    }
Пример #14
0
 public void move(Mapinfo M)
 {
     //if(gm.Turn == GM.GameState.)
     MovePlayer(M);
     MoveEnemy(M);
 }
Пример #15
0
    public void SelectJump(GameObject map)
    {
        Mapinfo M = GetSelectMap(map);

        this.gameObject.GetComponent <CharacterGM> ().ADDCharacterToMap(GGM.Clist[0], M);
    }
Пример #16
0
 public void ADDCharacterToMap(Enemy E_, Mapinfo M)
 {
     CreateCharacterOnMap(E_, M);
 }
Пример #17
0
    public void Addchararcter(Enemy E, int x, int y)
    {
        Mapinfo map = MGM.getmap(x, y);

        ADDCharacterToMap(E, map);
    }
Пример #18
0
    public List <EnemInfo> GetRightRow_CharacterE(Mapinfo M)
    {
        List <Mapinfo> m = MGM.GetRightRow(M);

        return(CheckInRange_CharacterE(m));
    }
Пример #19
0
    public List <Chainfo> GetLeftRow_Character(Mapinfo M)
    {
        List <Mapinfo> m = MGM.GetLeftRow(M);

        return(CheckInRange_Character(m));
    }
Пример #20
0
 public void ADDCharacterToMap(Character C_, Mapinfo M)
 {
     CreateCharacterOnMap(C_, M);
     updateCharacterBox();
 }
Пример #21
0
    public void MovePlayer(Mapinfo M)
    {
        List <Chainfo> Top   = GetTopRow_Character(M);
        List <Chainfo> Down  = GetDownRow_Character(M);
        List <Chainfo> Left  = GetLeftRow_Character(M);
        List <Chainfo> Right = GetRightRow_Character(M);

        if (Top.Count != 0)
        {
            for (int i = 0; i < Top.Count; i++)
            {
                if (Top [i].me != null)
                {
                    if (Top [i].Y > 0)
                    {
                        updateMap(Top [i]);
                        Top [i].Y -= 1;
                        Updatemove(Top [i]);
                    }
                }
            }
        }
        if (Down.Count != 0)
        {
            for (int i = 0; i < Down.Count; i++)
            {
                if (Down [i].me != null)
                {
                    if (Down [i].Y < MGM.GetmaxY())
                    {
                        updateMap(Down [i]);
                        Down [i].Y += 1;
                        Updatemove(Down [i]);
                    }
                }
            }
        }
        if (Left.Count != 0)
        {
            for (int i = 0; i < Left.Count; i++)
            {
                if (Left [i].me != null)
                {
                    if (Left [i].X < MGM.GetmaxX())
                    {
                        updateMap(Left [i]);
                        Left [i].X += 1;
                        Updatemove(Left [i]);
                    }
                }
            }
        }

        if (Right.Count != 0)
        {
            for (int i = 0; i < Right.Count; i++)
            {
                if (Right [i].me != null)
                {
                    if (Right [i].X > 0)
                    {
                        updateMap(Right [i]);
                        Right [i].X -= 1;
                        Updatemove(Right [i]);
                    }
                }
            }
        }
    }
Пример #22
0
    public void MoveEnemy(Mapinfo M)
    {
        List <EnemInfo> Top_E   = GetTopRow_CharacterE(M);
        List <EnemInfo> Down_E  = GetDownRow_CharacterE(M);
        List <EnemInfo> Left_E  = GetLeftRow_CharacterE(M);
        List <EnemInfo> Right_E = GetRightRow_CharacterE(M);

        //enemy
        if (Top_E.Count != 0)
        {
            for (int i = 0; i < Top_E.Count; i++)
            {
                if (Top_E [i].me != null)
                {
                    if (Top_E [i].Y > 0)
                    {
                        updateMap(Top_E [i]);
                        Top_E [i].Y -= 1;
                        Updatemove(Top_E [i]);
                    }
                }
            }
        }
        if (Down_E.Count != 0)
        {
            for (int i = 0; i < Down_E.Count; i++)
            {
                if (Down_E [i].me != null)
                {
                    if (Down_E [i].Y < MGM.GetmaxY())
                    {
                        updateMap(Down_E [i]);
                        Down_E [i].Y += 1;
                        Updatemove(Down_E [i]);
                    }
                }
            }
        }
        if (Left_E.Count != 0)
        {
            for (int i = 0; i < Left_E.Count; i++)
            {
                if (Left_E [i].me != null)
                {
                    if (Left_E [i].X < MGM.GetmaxX())
                    {
                        updateMap(Left_E [i]);
                        Left_E [i].X += 1;
                        Updatemove(Left_E [i]);
                    }
                }
            }
        }
        if (Right_E.Count != 0)
        {
            for (int i = 0; i < Right_E.Count; i++)
            {
                if (Right_E [i].me != null)
                {
                    if (Right_E [i].X > 0)
                    {
                        updateMap(Right_E [i]);
                        Right_E [i].X -= 1;
                        Updatemove(Right_E [i]);
                    }
                }
            }
        }
    }
Пример #23
0
 public void moveTurn(Mapinfo M)
 {
     MoveDelRoad(M);
 }