Beispiel #1
0
    public bool ChangeArmor(SpawnCode code, GameObject _parents, GameObject _child)
    {
        //언락 여부 체크
        if (!spawn.GetIsUnlocked(code))
        {
            return(false);
        }

        //캐릭터 스테이터스 초기화
        PlayerStatus ps = _parents.GetComponent <PlayerStatus>();

        ps.Init_HpDefence();

        //장비 생성 & 할당, 서버 통신
        Base_Armor ar;
        string     what = (code.ToString().Substring(0, 1));

        switch (what)
        {
        case "A":
            ar = spawn.GetArmor_Amulet(code, _child);
            ar.Execute(ps);
            router.PostRouter(PostType.PLAYER_AMULET_CHANGE, code);
            break;

        case "S":
            ar = spawn.GetArmor_Stone(code, _child);
            ar.Execute(ps);
            router.PostRouter(PostType.PLAYER_STONE_CHANGE, code);
            break;
        }

        return(true);
    }
Beispiel #2
0
    public bool ChangeWeapon(SpawnCode code, GameObject _parents, GameObject _child)
    {
        //언락 여부 체크
        if (!spawn.GetIsUnlocked(code))
        {
            return(false);
        }

        //장비 생성 & 할당
        string what = (code.ToString().Substring(0, 2));

        switch (what)
        {
        case "W0": spawn.GetWeapon_Sword(code, _child); break;

        case "W1": spawn.GetWeapon_Spear(code, _child); break;

        case "W2": spawn.GetWeapon_Bow(code, _child); break;
        }

        //무기 메커니즘 초기화
        _parents.GetComponent <PlayerStatus>().Init_Weapon();

        //서버 통신
        router.PostRouter(PostType.PLAYER_WEAPON_CHANGE, code);

        return(true);
    }
Beispiel #3
0
    public bool ChangeSkill(SpawnCode code, GameObject _parents, GameObject _child)
    {
        //언락 여부 체크
        if (!spawn.GetIsUnlocked(code))
        {
            return(false);
        }

        //스킬 생성 & 할당
        string what = (code.ToString().Substring(0, 1));

        switch (what)
        {
        case "R": spawn.GetSkill_Red(code, _child); break;

        case "G": spawn.GetSkill_Green(code, _child); break;

        case "B": spawn.GetSkill_Blue(code, _child); break;
        }

        //스킬 메커니즘 초기화
        _parents.GetComponent <PlayerStatus>().Init_Skill();

        //서버 통신
        router.PostRouter(PostType.PLAYER_SKILL_CHANGE, code);

        return(true);
    }
Beispiel #4
0
    //해당 코드를 언락함.
    public void UnlockCode(SpawnCode code)
    {
        //이미 언락이 되어 있다면 막기
        if (list.Contains(code))
        {
            return;
        }

        //리스트 올리고 서버에 통신
        list.Add(code);

        string str = code.ToString().Substring(0, 1);

        switch (str)
        {
        case "R":
        case "G":
        case "B":
            router.PostRouter(PostType.PLAYER_SKILL_UNLOCK, code); break;

        case "W":
            router.PostRouter(PostType.PLAYER_WEAPON_UNLOCK, code); break;

        case "A":
            router.PostRouter(PostType.PLAYER_AMULET_UNLOCK, code); break;

        case "S":
            router.PostRouter(PostType.PLAYER_STONE_UNLOCK, code); break;
        }
    }
    public override void DropItem() //Only Boss!
    {
        DropItemObject.GetComponent <DroppedItem>().dropItemCode = myMonsterInfo.monsterDropItemCode;

        //-----------------------------------아이템 드랍-----------------------------------
        DroppedItem item = Instantiate(DropItemObject).GetComponent <DroppedItem>();

        SpawnCode mDropItemCode = myMonsterInfo.monsterDropItemCode;

        item.name = myMonsterInfo.monsterName + " 드롭 아이템:" + mDropItemCode.ToString();

        int ranX = Random.Range(-100, 101);     //min ~ max-1
        int ranY = Random.Range(100, 201);      //min ~ max-1

        item.transform.position = GetComponent <Transform>().position;
        item.GetComponent <Rigidbody2D>().AddForce(new Vector3(ranX, ranY, 0));              //위 방향으로 랜덤 발사
    }
Beispiel #6
0
    public bool ChangeFood(SpawnCode code, GameObject _parents, GameObject _child)
    {
        //언락 여부 체크
        if (!spawn.GetIsUnlocked(code))
        {
            return(false);
        }

        //음식 생성 & 할당
        string what = (code.ToString().Substring(0, 1));

        switch (what)
        {
        case "F": spawn.GetFood(code, _child); break;
        }

        //음식 효과 적용
        _parents.GetComponent <PlayerStatus>().Init_Food();

        return(true);
    }
Beispiel #7
0
    public Sprite GetSource(SpawnCode code)
    {
        SpriteSource s = null;

        switch (code)
        {
        case SpawnCode.W001:
        case SpawnCode.W002:
        case SpawnCode.W003:
        case SpawnCode.W004:
        case SpawnCode.W005:
            s = Array.Find(weapon_sword, tmp => tmp.code == code); break;

        case SpawnCode.W101:
        case SpawnCode.W102:
        case SpawnCode.W103:
        case SpawnCode.W104:
        case SpawnCode.W105:
            s = Array.Find(weapon_spear, tmp => tmp.code == code); break;

        case SpawnCode.W201:
        case SpawnCode.W202:
        case SpawnCode.W203:
        case SpawnCode.W204:
        case SpawnCode.W205:
            s = Array.Find(weapon_bow, tmp => tmp.code == code); break;

        case SpawnCode.R001:
        case SpawnCode.R002:
        case SpawnCode.R003:
        case SpawnCode.R004:
        case SpawnCode.R005:
            s = Array.Find(skill_red, tmp => tmp.code == code); break;

        case SpawnCode.G001:
        case SpawnCode.G002:
        case SpawnCode.G003:
        case SpawnCode.G004:
        case SpawnCode.G005:
            s = Array.Find(skill_green, tmp => tmp.code == code); break;

        case SpawnCode.B001:
        case SpawnCode.B002:
        case SpawnCode.B003:
        case SpawnCode.B004:
        case SpawnCode.B005:
            s = Array.Find(skill_blue, tmp => tmp.code == code); break;


        case SpawnCode.A001:
        case SpawnCode.A002:
        case SpawnCode.A003:
        case SpawnCode.A004:
        case SpawnCode.A005:
            s = Array.Find(armor_Amulet, tmp => tmp.code == code); break;

        case SpawnCode.S001:
        case SpawnCode.S002:
        case SpawnCode.S003:
        case SpawnCode.S004:
        case SpawnCode.S005:
            s = Array.Find(armor_Stone, tmp => tmp.code == code); break;

        case SpawnCode.F001:
        case SpawnCode.F002:
        case SpawnCode.F003:
        case SpawnCode.F004:
        case SpawnCode.F005:
            s = Array.Find(food, tmp => tmp.code == code); break;
        }

        if (s == null)
        {
            Debug.LogWarning("SpriteSupplier: " + code.ToString() + " does not found!");
            return(null);
        }

        return(s.source);
    }