Esempio n. 1
0
        void Explode(Vector3 pos /*Tile tile*/)
        {
            float current_floor = (float)Math.Round(pos.y);

            foreach (var game_object in World.Instance(WorldId).GetGameObjects())
            {
                // 같은 층이 아닌 경우는 충돌 검사에서 제외
                if (NetGameObject.IsSameFloor(current_floor, game_object) == false)
                {
                    continue;
                }

                if (NetworkId != game_object.NetworkId && MathHelpers.circleRect(pos.x, pos.z, GetCollisionRadius(), game_object.rx, game_object.ry, game_object.rw, game_object.rh)
                    /*game_object.GetLocation().Round().Equals(pos)*/)
                {
                    game_object.OnExplode(mPlayerId, NetworkId, default_damage);
                }
            }

            //if (tile == null)
            //    return;

            //foreach(var game_object in tile.gameObjects)
            //{
            //    if(NetworkId != game_object.NetworkId)
            //        game_object.OnExplode(mPlayerId, NetworkId, default_damage);
            //}
        }
Esempio n. 2
0
        void HandleBomb()
        {
            if (mIsBomb == false)
            {
                return;
            }

            float time = Timing.sInstance.GetFrameStartTime();

            if (Timing.sInstance.GetFrameStartTime() <= mTimeOfNextBomb)
            {
                //Log.Information("It's still too early");
                return;
            }

            foreach (var game_object in World.Instance(WorldId).GetGameObjects())
            {
                if (game_object.GetClassId() != (uint)GameObjectClassId.Bomb)
                {
                    continue;
                }

                // 같은 층이 아닌 경우는 충돌 검사에서 제외
                if (NetGameObject.IsSameFloor(floor, game_object) == false)
                {
                    continue;
                }

                if (MathHelpers.circlesColliding(GetLocation().x, GetLocation().z, core.Bomb.DefaultCollisionRadius, game_object.GetLocation().x, game_object.GetLocation().z, game_object.GetCollisionRadius()))
                {
                    Log.Information("already installed bomb");
                    return;
                }
            }

            if (BasicAttack.skillType != (int)SkillType.InstallSkill)
            {
                Log.Information($"skill type error {BasicAttack.skillType}");
                return;
            }

            //not exact, but okay
            mTimeOfNextBomb = time + mTimeBetweenBomb;



            //install bomb
            var bomb = (core.Bomb)GameObjectRegistry.sInstance.CreateGameObject((uint)GameObjectClassId.Bomb, true, WorldId);

            bomb.InitFrom(this, BasicAttack);

            Log.Information("installed bomb success!");
        }