Example #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);
        }
Example #2
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);
                }
            }
        }
Example #3
0
 public void FromPrefabs(CharacterEditorData.CharacterEditorStateData editStateDt)
 {
     this.animation_name = editStateDt.m_animationName;
     this.total_frame    = editStateDt.m_totFrame;
     foreach (CharacterEditorData.CharacterEditorBombAttackData item in editStateDt.m_attackBmDatas)
     {
         int            frame = item.m_iFrame;
         AttackBombData pData = (AttackBombData)AttackBaseData.CreateInstance(item.m_attackType);
         pData.damage         = item.m_damage;
         pData.center_damage  = item.m_centerDamage;
         pData.bomb_config_id = item.m_bombCofigID;
         AttackData[frame]    = pData;
     }
     foreach (CharacterEditorData.CharacterEditorNormalAttackData item in editStateDt.m_attackNmDatas)
     {
         int frame = item.m_iFrame;
         AttackNormalData pData = (AttackNormalData)AttackBaseData.CreateInstance(item.m_attackType);
         AttackData[frame] = pData;
     }
 }