示例#1
0
        public bool Initialize(object[] args)
        {
            base.Initialize();

            _id       = (int)args[0];
            m_pHost   = args[1] as CharacterLogic;
            m_pConfig = args[2] as BombData;
            AttackBombData pData = args[3] as AttackBombData;

            m_pAttackInfo.m_pFight        = m_pHost;
            m_pAttackInfo.m_iDamage       = pData.damage;
            m_pAttackInfo.m_iCenterDamage = pData.center_damage;

            m_stShape          = GameGOW.Get().ResourceMgr.GetRes <Texture2D>(m_pConfig.m_strShapePath);
            m_stBorder         = GameGOW.Get().ResourceMgr.GetRes <Texture2D>(m_pConfig.m_strBorderPath);
            Network.n_stShape  = m_stShape;
            Network.n_stBorder = m_stBorder;

            _mass           = m_pConfig.m_fMass;
            _gravityFactor  = m_pConfig.m_fGFactor;
            _windFactor     = m_pConfig.m_fWindFactor;
            _airResitFactor = m_pConfig.m_fAirResitFactor;
            _testRect       = m_pConfig.m_pAttackRect;
            return(true);
        }
示例#2
0
 public BaseBomb()
     : base(0, 1, 10.0f, 100.0f, 1.0f, 1.0f)
 {
     _testRect     = new Rect(-3, -3, 9, 9);
     m_pConfig     = null;
     m_pHost       = null;
     m_stShape     = null;
     m_stBorder    = null;
     m_pAttackInfo = new AttackInfo();
 }
示例#3
0
        public void ThrowBomb(CharacterLogic pHost, AttackBombData pData, bool is_foucs)   //is_foucs 为camera是否跟踪
        {
            SkillINstructionData self_skill = GameGOW.Get().DataMgr.GetSkillINstructionDataByID(SkillManager.CurrentSkillId == 0?0:100 + SkillManager.CurrentSkillId);

            pData.damage        = self_skill.damage;
            pData.center_damage = self_skill.center_damage;
            BombData pBombData = GameGOW.Get().DataMgr.GetBombDataByID(pData.bomb_config_id);

            if (pBombData != null)
            {
                int uid;
                lock (locker)
                {
                    uid = GameGOW.Get().GetNextUid();
                }
                //   Debug.Log("EEEEEEEEEEEEEEEEEEEEEEE-------------UID"+uid);
                BaseBomb m_stBombLogic = ObjectPools.CheckOut <BaseBomb>(uid, pHost, pBombData, pData);
                //  Debug.Log("EEEEEEEEEEEEEEEEEEEEEEE-------------UID" + m_stBombLogic.Config.m_iResourceID);
                m_stBombLogic.Position = pHost.GetWeaponPosition();
                float radian;
                if (SkillManager.CurrentSkillId == (int)SkillManager.SkillType.Rocket)
                {
                    radian = MathUtil.AngleToRadian(pHost.GetFireAngle()) * pHost.m_pInfo.m_iFacing;
                    GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iFireAngle = SkillManager.PreAngle;
                }
                else
                {
                    radian = MathUtil.AngleToRadian(pHost.GetFireAngle() + pHost.CalcObjectAngle()) * pHost.m_pInfo.m_iFacing;
                }

                float speedX = pHost.m_pInfo.m_iBombSpeed * Mathf.Cos(radian) * pHost.m_pInfo.m_iFacing;
                float speedY = pHost.m_pInfo.m_iBombSpeed * Mathf.Sin(radian);

                m_stBombLogic.Start();
                if (SkillManager.thunder_bomb_num > 0)
                {
                    speedX = 0.0f;
                    speedY = 0.0f;

                    float val = GameGOW.Get().MapMgr.m_stBound.xMax - GameGOW.Get().MapMgr.m_stBound.xMin;
                    float add = val / 6;
                    m_stBombLogic.Position = new Vector2(GameGOW.Get().MapMgr.m_stBound.xMin + add * SkillManager.thunder_bomb_num, GameGOW.Get().MapMgr.m_stBound.yMax - 10);
                }
                m_stBombLogic.SetSpeedXY(speedX, speedY);
                m_dicBombs[uid] = m_stBombLogic;

                if (OnBombNew != null)
                {
                    OnBombNew(m_stBombLogic, is_foucs);
                }
            }
        }
示例#4
0
        private void LoadBombData()
        {
            string      path = Application.dataPath;
            Object      obj  = Resources.Load("Config/bomb_data");
            string      f    = obj.ToString();
            XmlDocument doc  = new XmlDocument();

            doc.LoadXml(f);
            XmlElement  root    = doc.DocumentElement;
            XmlNodeList xmlList = root.GetElementsByTagName("bomb");

            foreach (XmlNode node in xmlList)
            {
                XmlElement ele = node as XmlElement;

                int id = 0;
                XmlRead.Attr(ele, "", ref id);

                BombData pData = DataBase.CreateInstance <BombData>();
                pData.FromXml(ele);
                m_dicBombData[pData.config_id] = pData;
            }
        }