Пример #1
0
    public void Init(int row, int col, MapCtr map, AStarMap astarMap, PlayerCtrEx target, bool isLeft)
    {
        startRow = row;
        startCol = col;
        m_data   = GetComponent <PlayerData> ();
        m_data.Init(row, col, map);
        m_astarMap = astarMap;
        m_target   = target;

        m_data.RegisterMoveOverEvent(AutoMoveOver);
        if (isLeft)
        {
            if (m_astarMap.GetCell(m_data.Row, m_data.Column).IsToLeft)
            {
                m_data.Move(-1, 0);
            }
            else
            {
                m_data.Move(1, 0);
            }
        }
        else
        {
            if (m_astarMap.GetCell(m_data.Row, m_data.Column).IsToRight)
            {
                m_data.Move(1, 0);
            }
            else
            {
                m_data.Move(-1, 0);
            }
        }
    }
Пример #2
0
 public void Clear()
 {
     if (null != Player)
     {
         GameObject.Destroy(Player.gameObject);
     }
     foreach (DogCtr dog in m_dogList)
     {
         GameObject.Destroy(dog.gameObject);
     }
     m_player = null;
     m_dogList.Clear();
     //
     for (int i = 0; i < m_map.row; i++)
     {
         for (int j = 0; j < m_map.column; j++)
         {
             GameObject.Destroy(cells[j, i].gameObject);
             cells[j, i] = null;
         }
     }
     foreach (GameObject go in m_decorationList)
     {
         GameObject.Destroy(go);
     }
     m_decorationList.Clear();
     GameObject.Destroy(this.gameObject);
 }
Пример #3
0
    void LoadPlayer(int row, int col)
    {
        GameObject prefab = Resources.Load("Player") as GameObject;
        GameObject player = GameObject.Instantiate(prefab);

        m_player = player.GetComponent <PlayerCtrEx> ();
        m_player.Init(row, col, this);
    }
Пример #4
0
    // Use this for initialization
    public void Init(int row, int col, MapCtr map, AStarMap astarMap, PlayerCtrEx target)
    {
        startRow = row;
        startCol = col;
        m_data   = GetComponent <PlayerData> ();
        m_data.Init(row, col, map);
        m_astarMap = astarMap;
        m_target   = target;

        m_data.RegisterMoveOverEvent(MoveOver);
        FindPath();
    }