コード例 #1
0
        private BornNode GetCanAddPropNode()
        {
            BornNode[] roleBornNodes = (Global.gApp.CurScene as FightScene).GetBornNodes();
            int        count         = roleBornNodes.Length;
            int        symbol        = Random.Range(0, 1000);
            int        bornIndex     = Random.Range(0, count);

            if (symbol > 500)
            {
                symbol = 1;
            }
            else
            {
                symbol     = -1;
                bornIndex += count;
            }
            for (int i = 0; i < count; i++)
            {
                int      newIndex = bornIndex % count;
                BornNode newNode  = roleBornNodes[newIndex];
                if (newNode.GetIsOutMap())
                {
                    return(newNode);
                }
            }
            return(null);
        }
コード例 #2
0
        public override bool CheckState()
        {
            if (m_Pet.InCameraView || !m_LockCompt.GetIsOutMap() || m_InvisibleTime < m_InvisibleThreadHoldTime)
            {
                return(false);
            }
            return(false);

            m_Pet.ChangeToFlashState();
            return(true);
        }
コード例 #3
0
 public bool GenerateBornNode()
 {
     if (m_CurBornNode != null && m_CurBornNode.GetIsOutMap())
     {
         return(false);
     }
     foreach (BornNode bornNode in m_BornNodes)
     {
         if (bornNode.GetIsOutMap())
         {
             m_CurBornNode = bornNode;
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
ファイル: Wave.cs プロジェクト: howelllucas/Project
        //lockExterAdd = true lock push item to RoundRoleMonsterInfo and call CreateMonsterFromCacheInfo  limit by frameCreate count
        private bool CreateRoundMonsterImp(MonsterItem monsterItem, BornNode bornNode, bool lockExterAdd = false)
        {
            if (bornNode.GetIsOutMap())
            {
                Monster monster = null;
                if (!lockExterAdd)
                {
                    monster = m_WaveMgr.CreateMonster(monsterItem);
                }
                else
                {
                    monster = m_WaveMgr.CreateMonsterFromCacheInfo(monsterItem);
                }
                if (monster != null)
                {
                    Vector3 position = bornNode.transform.position;
                    position.z = 0;
                    monster.transform.position = position;
                    m_Monsters.Add(monster);
                    monster.Init(m_MainPlayer, this, monsterItem);
                    return(true);
                }
                else
                {
                    if (!lockExterAdd)
                    {
                        AddRoundRoleMonsterInfo(monsterItem);
                        return(false);
                    }
                }
            }
            else
            {
                int count     = m_RoundRoleBornNodes.Length;
                int symbol    = Random.Range(0, 1000);
                int bornIndex = Random.Range(0, count);
                if (symbol > 500)
                {
                    symbol = 1;
                }
                else
                {
                    symbol     = -1;
                    bornIndex += count;
                }
                for (int i = 0; i < count; i++)
                {
                    int      newIndex = bornIndex % count;
                    BornNode newNode  = m_RoundRoleBornNodes[newIndex];
                    if (newNode.GetIsOutMap())
                    {
                        Monster monster = null;
                        if (!lockExterAdd)
                        {
                            monster = m_WaveMgr.CreateMonster(monsterItem);
                        }
                        else
                        {
                            monster = m_WaveMgr.CreateMonsterFromCacheInfo(monsterItem);
                        }
                        if (monster != null)
                        {
                            Vector3 position = newNode.transform.position;
                            position.z = 0;
                            monster.transform.position = position;
                            m_Monsters.Add(monster);
                            monster.Init(m_MainPlayer, this, monsterItem);
                            return(true);
                        }
                        else
                        {
                            if (!lockExterAdd)
                            {
                                AddRoundRoleMonsterInfo(monsterItem);
                            }
                            return(false);
                        }
                    }
                    bornIndex += symbol;
                }
            }

            if (!lockExterAdd)
            {
                AddRoundRoleMonsterInfo(monsterItem);
            }
            return(false);
        }