Пример #1
0
    /**
     * @brief 유닛을 생성함 (서버에서 클라로 정보를 보낼때 호출됨)
     * @param posX 생성할 X 위치
     * @param posY 생성할 Y 위치
     * @param index 유닛 코드
     * @param uniqueNumber 생성자
     * @param byX 생성을 지시한 X 위치
     * @param byY 생성을 지시한 Y 위치
     */
    public void CreateUnit(int posX, int posY, int index, int uniqueNumber, int byX, int byY)
    {
        GameObject Child = Instantiate(unitobj[index - 300], GameMng.I._hextile.GetCell(posX, posY).transform) as GameObject;

        Child.transform.parent = transform.parent;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj = Child.GetComponent <Unit>();
        GameMng.I._hextile.GetCell(posX, posY)._code    = GameMng.I._hextile.GetCell(posX, posY)._unitObj._code;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj._uniqueNumber = uniqueNumber;
        Debug.Log(GameMng.I._hextile.GetCell(byX, byY)._builtObj);
        GameMng.I._hextile.GetCell(byX, byY)._builtObj._bActAccess = false;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj.SaveX      = byX;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj.SaveY      = byY;

        GameMng.I.addActMessage(string.Format("{0}님이 일꾼을 생성하고 있습니다.", GameMng.I.getUserName(uniqueNumber)), posX, posY);

        GameMng.I.addLogMessage(GameMng.I.getUserName(uniqueNumber), "일꾼을 생성하고 있습니다.");

        if (GameMng.I._hextile.GetCell(byX, byY)._builtObj._code == (int)BUILT.MILLITARY_BASE)
        {
            MillitaryBase SaveData = GameMng.I._hextile.GetCell(byX, byY)._builtObj.GetComponent <MillitaryBase>();
            SaveData.CreatingUnitobj = GameMng.I._hextile.GetCell(posX, posY)._unitObj.gameObject;
            SaveData.GetComponent <MillitaryBase>().CreatingUnitX = posX;
            SaveData.GetComponent <MillitaryBase>().CreatingUnitY = posY;
        }
    }
Пример #2
0
    /**
     * @brief 유닛을 생성함 (서버에서 클라로 정보를 보낼때 호출됨)
     * @param posX 생성할 X 위치
     * @param posY 생성할 Y 위치
     * @param index 유닛 코드
     * @param uniqueNumber 생성자
     * @param byX 생성을 지시한 X 위치
     * @param byY 생성을 지시한 Y 위치
     */
    public void CreateUnit(int posX, int posY, int index, int uniqueNumber, int byX, int byY)
    {
        GameObject Child = Instantiate(unitobj[index - 300], GameMng.I._hextile.GetCell(posX, posY).transform) as GameObject;

        Child.transform.parent = transform.parent;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj = Child.GetComponent <Unit>();
        GameMng.I._hextile.GetCell(posX, posY)._code    = GameMng.I._hextile.GetCell(posX, posY)._unitObj._code;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj._uniqueNumber = uniqueNumber;
        GameMng.I._hextile.GetCell(byX, byY)._builtObj._bActAccess    = false;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj.SaveX         = byX;
        GameMng.I._hextile.GetCell(posX, posY)._unitObj.SaveY         = byY;

        if (GameMng.I._hextile.GetCell(byX, byY)._builtObj._code == (int)BUILT.MILLITARY_BASE)
        {
            MillitaryBase SaveData = GameMng.I._hextile.GetCell(byX, byY)._builtObj.GetComponent <MillitaryBase>();
            SaveData.CreatingUnitobj = GameMng.I._hextile.GetCell(posX, posY)._unitObj.gameObject;
            SaveData.GetComponent <MillitaryBase>().CreatingUnitX = posX;
            SaveData.GetComponent <MillitaryBase>().CreatingUnitY = posY;
        }
    }