Exemplo n.º 1
0
    private void RegisterMonster(eMonsterType eType)
    {
        if (true == IsHasMonsterToPlayerPrefs(eType))
        {
            return;
        }

        SetMonsterTypeToPlayerPrefs(eType, eGoodsState.Enable);
    }
Exemplo n.º 2
0
    SHUIWidget_Monster CreateMonsterSlot(eMonsterType eType)
    {
        if ((eMonsterType.None == eType) || (eMonsterType.Max_NormalMonster == eType) || (eMonsterType.Max == eType))
        {
            return(null);
        }

        return(Single.ObjectPool.Get <SHUIWidget_Monster>(SHHard.GetMonsterName(eType),
                                                          ePoolReturnType.ChangeScene, ePoolDestroyType.ChangeScene));
    }
Exemplo n.º 3
0
 IEnumerator GeneratingMonster(UIScene_Game _game)
 {
     while (true)
     {
         float        n    = Random.Range(4f, 7f);
         int          m    = Random.Range(1, (int)(eMonsterType.Monster_Size + 1));
         eMonsterType type = (eMonsterType)m;
         MonsterActorV1.CreateMonster(type, transform.position, transform.rotation, _game.HitMonster, _game.MissMonster, m_eType);
         yield return(new WaitForSeconds(n));
     }
 }
Exemplo n.º 4
0
    public void SetMonsterTypeToPlayerPrefs(eMonsterType eMonType, eGoodsState eGoods)
    {
        if (eGoodsState.Disable == eGoods)
        {
            if (MIN_ENABLE_COUNT >= GetEnableMonstersToPlayerPrefs().Count)
            {
                Single.UI.ShowNotice("알림", "몬스터는 최소 5마리 이상입니다.");
                return;
            }
        }

        SHPlayerPrefs.SetInt(string.Format("Inventory_Monste_{0}", (int)eMonType), (int)eGoods);
    }
Exemplo n.º 5
0
    void SetMonsterSlot(eMonsterType eType, SHUIWidget_Monster pMonster, SHUIWidget_ItemSlot pSlot)
    {
        if ((null == pMonster) || (null == pSlot))
        {
            return;
        }

        SHGameObject.SetParent(pMonster.GetGameObject(), pSlot.GetGameObject());
        pMonster.Initialize(eType, 0.5f, 0.0f, 0.0f);
        pMonster.SetLocalPosition(Vector3.zero);
        pMonster.SetLocalScale(Vector3.one);
        pMonster.StopMoveTween();
        pMonster.SetActive(true);
    }
Exemplo n.º 6
0
    private SHUIWidget_Monster CreateMonster(eMonsterType eType, float fFactor, float fStartPosY)
    {
        var pMonster = Single.ObjectPool.Get <SHUIWidget_Monster>(SHHard.GetMonsterName(eType));

        if (null == pMonster)
        {
            return(null);
        }

        SHGameObject.SetParent(pMonster.transform, Single.UI.GetRootToScene());
        Single.ObjectPool.SetStartTransform(pMonster.gameObject);
        pMonster.SetActive(true);
        pMonster.Initialize(eType, fFactor, Single.Balance.GetMonsterSpeed(), fStartPosY);
        return(pMonster);
    }
Exemplo n.º 7
0
    public void Initialize(eMonsterType eType1, eMonsterType eType2)
    {
        ReturnStickObject(m_pLeftMonster);
        ReturnStickObject(m_pRightMonster);
        SetMonsterSlot(
            (m_eLeftType = eType1),
            (m_pLeftMonster = CreateMonsterSlot(eType1)),
            m_pLeftSlot);
        SetMonsterSlot(
            (m_eRightType = eType2),
            (m_pRightMonster = CreateMonsterSlot(eType2)),
            m_pRightSlot);

        SetGoodsState();
    }
Exemplo n.º 8
0
 public static string GetMonsterName(eMonsterType eType)
 {
     return(eType.ToString());
 }
Exemplo n.º 9
0
 protected Monster(eMonsterType type) : base(eCreatureType.Monster)
 {
     this.type = type;
 }
Exemplo n.º 10
0
 public Sprite[] GetMonsterParts(eMonsterType type)
 {
     //해당 타입의 스프라이트들을 넘겨줌.
     return(m_monsterParts[(int)type].m_parts);
 }
Exemplo n.º 11
0
 public eGoodsState GetMonsterGoodsStateToPlayerPrefs(eMonsterType eType)
 {
     return((eGoodsState)SHPlayerPrefs.GetInt(
                string.Format("Inventory_Monste_{0}", (int)eType), (int)eGoodsState.NotHas));
 }
Exemplo n.º 12
0
 public bool IsEnableMonsterToPlayerPrefs(eMonsterType eType)
 {
     return(eGoodsState.Enable == GetMonsterGoodsStateToPlayerPrefs(eType));
 }
Exemplo n.º 13
0
 public bool IsHasMonsterToPlayerPrefs(eMonsterType eType)
 {
     return(eGoodsState.NotHas != GetMonsterGoodsStateToPlayerPrefs(eType));
 }
Exemplo n.º 14
0
 public void Initialize(eMonsterType eType, float fFactor, float fSpeed, float fStartPosY)
 {
     m_eType = eType;
     ChangeState(eState.Idle, fFactor, fSpeed, fStartPosY);
 }
Exemplo n.º 15
0
    public static MonsterActorV1 CreateMonster(eMonsterType type, Vector3 pos, Quaternion rot, HitMonter _delHitMonster = null, MissMonster _delMissMonster = null, eMonsterBehaviourType bType = eMonsterBehaviourType.Type_RunAttackRun)
    {
        if (!bIsMonsterGlobalDataInitialized)
        {
            InitGlobalData();
            bIsMonsterGlobalDataInitialized = true;
        }
        string path = m_dMonsterPath[type];
        //根据指定路径,位置和旋转
        MonsterActorV1 ma = LoadPrefab <MonsterActorV1>(path, pos, rot);

        //=======================设置怪兽的基本属性===============================
        //1 设置出生位置
        ma.m_vBirthPoint = new Vector3(pos.x + ma.m_fSize, pos.y, pos.z);
        //2 设置回收未知
        //pos.x - Camera.main.position.x得到相机视野宽度
        //Camera.main.position.x - (pos.x - Camera.main.position.x) -> 相机视野左边界X坐标
        ma.m_vDeadpoint = new Vector3(2 * Camera.main.transform.position.x - pos.x - ma.m_fSize, pos.y, pos.z);

        //设置怪兽出生速度
        ma.m_fSpeed = Random.Range(3f, 5f);
        //用来判定怪兽什么时候开始转身
        ma.m_fPercentage = Random.Range(0.2f, 0.6f);
        ma.m_eState      = eMonsterState.Monster_RunAway;
        //出生朝向角度
        ma.m_qBirthQuaternion = ma.transform.rotation;
        //攻击朝向角度
        ma.m_qTurnQuaternion = ma.transform.rotation * Quaternion.Euler(new Vector3(0f, -90f, 0f));
        if (null != ma.RB)
        {
            ma.RB.isKinematic = true;
            GlobalHelper.SetGameObjectLayer(ma.gameObject, "Monster");
            //ma.gameObject.layer = LayerMask.NameToLayer("Monster");
        }
        //获取当前游戏对象的动画控制器
        if (null != ma.ANIM
            )
        {
        }

        //启动怪兽UI
        ma.UI_BasePlayerInfos.OnStart(ma);

        //初始化shader
        ma.InitShaderProperties();

        //初始化命中怪兽代理事件
        if (null != _delHitMonster)
        {
            ma.m_delHitMonster = _delHitMonster;
        }

        //初始化丢失怪兽代理事件
        if (null != _delMissMonster)
        {
            ma.m_delMissMonster = _delMissMonster;
        }
        //===================================================================

        //设定怪兽出生行为类型
        ma.m_eBehaviourType = bType;
        if (bType == eMonsterBehaviourType.Type_BezierLine)
        {
            ma.InitializeBezierLineInfos();
        }

        return(ma);
    }