Example #1
0
    //스폰
    public void Despawn(GameObject go)
    {
        Define.WorldObject type = GetWorldObjectType(go);

        switch (type)
        {
        case Define.WorldObject.Monster:
        {
            if (_monsters.Contains(go))
            {
                _monsters.Remove(go);
                if (OnSpawnEvent != null)
                {
                    OnSpawnEvent.Invoke(-1);
                }
            }
        }
        break;

        case Define.WorldObject.Player:
        {
            if (_player == go)
            {
                _player = null;
            }
        }
        break;
        }

        Managers.Resource.Destroy(go);
    }
Example #2
0
    public GameObject Spawn(Define.WorldObject type, string path, Transform parent = null)
    {
        GameObject go = Managers.Resource.Instantiate(path, parent);

        switch (type)
        {
        case Define.WorldObject.Unknown:
            break;

        case Define.WorldObject.Player:
            _player = go;
            break;

        case Define.WorldObject.Monster:
            _monsters.Add(go);
            if (OnSpawnEvent != null)
            {
                OnSpawnEvent.Invoke(1);     // 한마리가 늘었다
            }
            break;

        default:
            break;
        }

        return(go);
    }
    public override void SetStat(Define.WorldObject type, string id)
    {
        Dictionary <string, ContentsData.CharacterStat> statDict = Managers.Data.CharacterStatDict;

        ContentsData.CharacterStat stat = statDict[id];

        Id          = stat.ID;
        MaxHp       = stat.HP;
        Hp          = int.Parse(MaxHp.ToString());
        MaxMp       = stat.MP;
        Mp          = int.Parse(MaxMp.ToString());
        Attack      = stat.Attack;
        Defense     = stat.Defense;
        AttackSpeed = stat.AttackSpeed;
        MoveSpeed   = stat.MoveSpeed;
        AttackRange = stat.AttackRange;

        Level       = stat.Level;
        SubName     = stat.SubName;
        Description = stat.Description;
        STR         = stat.STR;
        AGI         = stat.AGI;
        INT         = stat.INT;
        Exp         = stat.EXP;

        Gold       = 1000;
        CurrentExp = 0;
    }
Example #4
0
    public GameObject Spawn(Define.WorldObject type, string path, Transform parent = null)
    {
        GameObject go = Managers.Resource.Instantiate(path, parent);

        //switch (type)
        //{
        //    case Define.WorldObject.Tree:
        //        break;
        //    case Define.WorldObject.Flower:
        //        break;
        //}

        return(go);
    }
    public override void SetStat(Define.WorldObject type, string id)
    {
        Dictionary <string, ContentsData.MonsterStat> statDict = Managers.Data.MonsterStatDict;

        ContentsData.MonsterStat stat = statDict[id];

        Id          = stat.ID;
        MaxHp       = stat.HP;
        Hp          = int.Parse(MaxHp.ToString());
        MaxMp       = 0;
        Mp          = 0;
        AttackRange = stat.AttackRange;
        AttackSpeed = stat.AttackSpeed;
        MoveSpeed   = stat.MoveSpeed;
        Attack      = stat.Attack;
        Defense     = stat.Defense;
        Exp         = stat.EXP;
        Gold        = stat.Gold;
    }
Example #6
0
    //스폰
    public GameObject Spawn(Define.WorldObject type, string path, Transform parent = null) //서버의 경우 path 가 아닌, 고유 id, number를 던져주면 그 numer로 몬스터 디렉토리스크립트에서 긁어오거나 함
    {
        GameObject go = Managers.Resource.Instantiate(path, parent);

        switch (type)
        {
        case Define.WorldObject.Monster:
            _monsters.Add(go);
            if (OnSpawnEvent != null)
            {
                OnSpawnEvent.Invoke(1);
            }
            break;

        case Define.WorldObject.Player:
            _player = go;
            break;
        }

        return(go);
    }
Example #7
0
    public GameObject Spawn(Define.WorldObject type, string path, Vector3 pos, Transform parent = null)
    {
        GameObject go = Managers.Resource.Instantiate(path, pos, parent);

        switch (type)
        {
        case Define.WorldObject.Chracter:
        {
            _player = go;
        }
        break;

        case Define.WorldObject.Monster:
        {
            go.GetOrAddComponent <MonsterController>();
            MonsterCount++;
        }
        break;
        }

        return(go);
    }
Example #8
0
    public void DeSpawn(GameObject go)
    {
        Define.WorldObject type = GetWorldObjectType(go);

        switch (type)
        {
        case Define.WorldObject.Chracter:
        {
            if (_player == go)
            {
                _player = null;
            }
        }
        break;

        case Define.WorldObject.Monster:
        {
            MonsterCount--;
        }
        break;
        }

        Managers.Resource.Destroy(go);
    }
Example #9
0
    public GameObject Spawn(Define.WorldObject type, string path, Transform parent = null)
    {
        GameObject go = Managers.Resource.Instantiate(path, parent);

        return(go);
    }
Example #10
0
 public virtual void SetStat(Define.WorldObject type, string Id)
 {
 }