コード例 #1
0
ファイル: SnowballThrower.cs プロジェクト: AArtlone/SnowBrawl
    private IEnumerator ThrowCo(bool facingRight, PlayerID playerID, Action doneShootingCallback)
    {
        // We need to wait for the animation to finish before the showball is instantiated
        yield return(new WaitForSeconds(throwingAnimDuration));

        Snowball snowball = Instantiate(snowballPrefab, throwingPoint.position, Quaternion.identity);

        snowball.Throw(GetThrowingDirection(facingRight), speed, playerID);

        if (doneShootingCallback != null)
        {
            doneShootingCallback();
        }

        yield return(new WaitForSeconds(snowballDestroyDelay));

        if (GameManager.Instance.GameIsPaused)
        {
            yield break;
        }

        if (snowball == null)
        {
            yield break;
        }

        Destroy(snowball.gameObject);
    }
コード例 #2
0
        static void Main(string[] args)
        {
            int             n            = int.Parse(Console.ReadLine());
            BigInteger      biggestValue = 0;
            List <Snowball> snowballs    = new List <Snowball>();

            for (int i = 0; i < n; i++)
            {
                Snowball snowball = new Snowball();
                snowball.Snow     = double.Parse(Console.ReadLine());
                snowball.Time     = double.Parse(Console.ReadLine());
                snowball.Quantity = int.Parse(Console.ReadLine());
                snowball.Value    = BigInteger.Pow((BigInteger)(snowball.Snow / snowball.Time), snowball.Quantity);

                if (snowball.Value >= biggestValue)
                {
                    biggestValue = snowball.Value;
                }

                snowballs.Add(snowball);
            }

            foreach (var s in snowballs)
            {
                if (s.Value == biggestValue)
                {
                    Console.WriteLine($"{s.Snow} : {s.Time} = {s.Value} ({s.Quantity})");
                    break;
                }
            }
        }
コード例 #3
0
 public void LoadSnowball()
 {
     currentSnowball = Instantiate(snowballPrefab, snowballHolder).GetComponent <Snowball>();
     currentSnowball.SetParentBone(snowballHolder);
     currentSnowball.SetLayerMask(gameObject.layer);
     snowballLoaded = true;
 }
コード例 #4
0
ファイル: ItemSnowball.cs プロジェクト: venomshock/MiNET
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            if (player.GameMode != GameMode.Creative)
            {
                Item itemStackInHand = player.Inventory.GetItemInHand();
                itemStackInHand.Count--;

                if (itemStackInHand.Count <= 0)
                {
                    // set empty
                    player.Inventory.Slots[player.Inventory.Slots.IndexOf(itemStackInHand)] = new ItemAir();
                }
            }

            float force = 1.5f;

            Snowball snowBall = new Snowball(player, world);

            snowBall.KnownPosition     = (PlayerLocation)player.KnownPosition.Clone();
            snowBall.KnownPosition.Y  += 1.62f;
            snowBall.Velocity          = snowBall.KnownPosition.GetDirection() * (force);
            snowBall.BroadcastMovement = false;
            snowBall.DespawnOnImpact   = true;
            snowBall.SpawnEntity();
        }
コード例 #5
0
    private void OnTriggerEnter(Collider otherCollider)
    {
        Snowball otherSnowball = otherCollider.GetComponent <Snowball>();

        if (otherSnowball != null)
        {
            if (canBreak == false)
            {
                otherSnowball.Break();
            }
            else
            {
                float p = 1 - Mathf.Sqrt(1 - destructionChance);
                if (Random.Range(0f, 1f) < p)
                {
                    otherSnowball.Break();
                    Break();
                }
            }
        }
        else
        {
            if (_debuffEffect != null)
            {
                _debuffEffect.Debuff(otherCollider.gameObject);
            }

            Break();
        }
    }
コード例 #6
0
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     snowball         = GetComponent <Snowball>();
     // Set target direction for the character body to its inital state.
     rb = GetComponent <Rigidbody>();
     targetCharacterDirection = rb.transform.localRotation.eulerAngles;
 }
コード例 #7
0
        public override RainDrop CreateNeutralRainDrop()
        {
            // snowball image
            BitmapImage img      = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(Application.Current.MainWindow), "../Images/snowball.png"));
            Snowball    snowball = new Snowball(img);

            return(snowball);
        }
コード例 #8
0
        private void OnTriggerEnter(Collider other)
        {
            Snowball snowball = other.gameObject.GetComponent <Snowball>();

            if (snowball != null)
            {
                TakeDamage(snowball.damage);
            }
        }
コード例 #9
0
    private void MissSnowball(TargetProjectile projectile)
    {
        //print("Missed");

        Snowball snowball = projectile.GetComponent <Snowball>();

        snowballs.Remove(snowball);
        Destroy(projectile.gameObject);
    }
コード例 #10
0
    private void HitSnowball(TargetProjectile projectile, GameObject hitObj)
    {
        //print("Hit");

        Snowball snowball = projectile.GetComponent <Snowball>();

        snowballs.Remove(snowball);
        Destroy(snowball.gameObject);
    }
コード例 #11
0
ファイル: ChurchBell.cs プロジェクト: aerobless/SnowfallVR
        private void OnTriggerEnter(Collider other)
        {
            Snowball snowball = other.gameObject.GetComponent <Snowball>();

            if (snowball != null && _bellsAreRinging == false)
            {
                RingChurchBell();
            }
        }
コード例 #12
0
ファイル: Snowball.cs プロジェクト: JoshuaKey/GameStudioEP
    private void OnTriggerEnter(Collider other)
    {
        Snowball snowball = other.GetComponentInChildren <Snowball>();

        if (snowball != null)
        {
            Destroy(this.gameObject);
        }
    }
コード例 #13
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Snowball snowBall = collision.gameObject.GetComponent <Snowball>();

        if (snowBall != null)
        {
            hitBySnowball(snowBall);
        }
    }
コード例 #14
0
        private void OnTriggerEnter(Collider other)
        {
            Snowball snowball = other.gameObject.GetComponent <Snowball>();

            if (snowball != null)
            {
                int damage = 20; //TODO: read damage from snowball, determine damage by throw speed?
                health -= damage;
                Debug.Log($"Snowman was attacked for {damage} damage. Remaining health: {health}");
            }
        }
コード例 #15
0
 private void hitBySnowball(Snowball snowball)
 {
     if (isAbSnowman)
     {
         AbSnowmanHitBySnowball(snowball);
     }
     else
     {
         SnowmanHitBySnowBall(snowball);
     }
 }
コード例 #16
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            float force = 1.5f;

            var snowBall = new Snowball(player, world);

            snowBall.KnownPosition    = (PlayerLocation)player.KnownPosition.Clone();
            snowBall.KnownPosition.Y += 1.62f;
            snowBall.Velocity         = snowBall.KnownPosition.GetDirection().Normalize() * force;
            snowBall.SpawnEntity();
        }
コード例 #17
0
ファイル: ItemSnowball.cs プロジェクト: CRBairdUSA/MiNET
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            float force = 1.5f;

            Snowball snowBall = new Snowball(player, world);
            snowBall.KnownPosition = (PlayerLocation) player.KnownPosition.Clone();
            snowBall.KnownPosition.Y += 1.62f;
            snowBall.Velocity = snowBall.KnownPosition.GetDirection()*(force);
            snowBall.BroadcastMovement = false;
            snowBall.DespawnOnImpact = true;
            snowBall.SpawnEntity();
        }
コード例 #18
0
    public void ReleaseSnowBall()
    {
        // This method is only to be called by the animator
        if (currentSnowball == null)
        {
            return;
        }

        snowballLoaded = false;
        currentSnowball.ReleaseMe();
        currentSnowball = null;
    }
コード例 #19
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            float force = 1.5f;

            Snowball snowBall = new Snowball(player, world)
            {
                KnownPosition = (PlayerLocation)player.KnownPosition.Clone(),
                Velocity      = new Vector3(blockCoordinates.X, blockCoordinates.Y, blockCoordinates.Z).Normalize() * force
            };

            snowBall.KnownPosition.Y += 1.62f;
            snowBall.SpawnEntity();
        }
コード例 #20
0
ファイル: ItemSnowball.cs プロジェクト: yesdog/MiNET
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            float force = 1.5f;

            Snowball snowBall = new Snowball(player, world);

            snowBall.KnownPosition     = (PlayerLocation)player.KnownPosition.Clone();
            snowBall.KnownPosition.Y  += 1.62f;
            snowBall.Velocity          = snowBall.KnownPosition.GetDirection() * (force);
            snowBall.BroadcastMovement = true;
            snowBall.DespawnOnImpact   = true;
            snowBall.SpawnEntity();
        }
コード例 #21
0
    private void AbSnowmanHitBySnowball(Snowball snowball)
    {
        if (snowball.thrower == this)
        {
            return;
        }
        if (this.currentTeam != null && snowball.thrower.currentTeam == this.currentTeam) // no friendly fire at the moment
        {
            return;
        }

        damagePlayer(snowball.damage);
    }
コード例 #22
0
    private void ReceiveSnowball(TargetReceiver receiver, GameObject snowballObj)
    {
        stateMachine.ChangeState("Boss3_Stop");
        //StopAllCoroutines();

        for (int i = 0; i < snowballs.Count;)
        {
            Snowball snowball = snowballs[i];
            snowballs.Remove(snowball);
            Destroy(snowball.gameObject);
        }

        StartCoroutine(FallDown());
    }
コード例 #23
0
    private void Shoot(CommandAlias action)
    {
        //convert letter-number coordinate input from action.alias[0] to bytepair
        BytePair coord = BytePair.StringListToCoordinates(action.Alias, GameManager.instance.MapHandler.MapHeight - 1, -1);

        if (coord.x == 255 || coord.y == 255)
        {
            print("Invalid coordinate"); return;
        }

        Snowball newBall = (Snowball)Pool.instance.GetFromPool("Assorted", "Snowball");

        newBall.SetTargetAndShoot(this, coord);
        newBall.Setup();

        Act();
    }
コード例 #24
0
        public void SpawnSnowball(bool addToList, string name)
        {
            if (currentLevel == null)
            {
                return;
            }

            Snowball     snowball     = new Snowball();
            SnowballName snowballName = new SnowballName(true, true, name);

            snowball.Add(snowballName);
            if (addToList)
            {
                spawnedSnowballs.Add(snowball);
            }
            currentLevel.Add(snowball);

            snowball.X = currentLevel.Camera.Left - 60f;
        }
コード例 #25
0
    public void SpawnSnowball()
    {
        Snowball snowball = Instantiate(SnowballPrefab, SpawnPosition.position, SpawnPosition.rotation, this.transform);

        snowball.Acceleration       = SnowballAcceleration;
        snowball.projectile.OnHit  += HitSnowball;
        snowball.projectile.OnMiss += MissSnowball;
        snowballs.Add(snowball);

        Vector3 dest = Vector3.zero;

        dest.x = SpawnArea.bounds.center.x + SpawnArea.bounds.extents.x * Random.Range(-1f, 1f);
        dest.y = SpawnArea.bounds.center.y + SpawnArea.bounds.extents.y * Random.Range(-1f, 1f);
        dest.z = SpawnArea.bounds.center.z + SpawnArea.bounds.extents.z * Random.Range(-1f, 1f);

        Vector3 peak = Utility.CreatePeak(SpawnPosition.position, dest, 20);

        StartCoroutine(ThrowSnowball(snowball, dest, peak));
    }
コード例 #26
0
    //------------------------------------------------------------------------------------------
    // Allows players to dash and phase right through snowballs
    //------------------------------------------------------------------------------------------
    private void Projectiles()
    {
        Dash     scpDash     = gameObject.GetComponent <Dash>();
        Snowball scpSnowball = m_goSnowball.GetComponent <Snowball>();

        //Dash scpDash = gameObject.GetComponent<Dash>();

        // If you are dashing through a snowball that is stationary and have a ball.
        if (!scpSnowball.m_bTooFast && m_bHasBall && !scpDash.m_bDashing)
        {
            // Array of snowballs in the scene.
            Snowball[] arrSnowballs = FindObjectsOfType <Snowball>();

            for (int i = 0; i < arrSnowballs.Length; i++)
            {
                // Disable collider on snowball.
                Physics.IgnoreCollision(arrSnowballs[i].gameObject.GetComponent <Collider>(), gameObject.GetComponent <Collider>(), false);
            }
        }
    }
コード例 #27
0
        /// <summary>
        /// THIS METHOD CREATES AND INITALIZES ALL THE SPRITES, MUSIC, ECT
        /// </summary>
        private void StartUp()
        {
            Banner       banner;
            Flag         flag;
            Lives        lives;
            SpaceKey     space;
            HighestScore HScore;
            Snowball     snow;

            //BACKGROUND
            background = new Background(SkiingGameCoursework.Content.Background, new Vector2(0, 0), SkiingGameCoursework.Content.Background.Width, SkiingGameCoursework.Content.Background.Height, 0.0f);
            background.Initialize(GraphicsDevice);

            skier = new Skier(SkiingGameCoursework.Content.Skier, new Vector2(350, 170), 29, 63, 0.2f);
            flag  = new Flag();
            lives = new Lives();
            space = new SpaceKey(spaceBar, new Vector2(150, 300), 500, 80);
            Res   = new RestartPrompt();
            Cheese cheese = new Cheese();

            snow   = new Snowball(snowballSpriteSheet, new Vector2(310, -210), 65, 65);
            banner = new Banner(SkiingGameCoursework.Content.TVBanner, new Vector2(50, 400), 1252, 42, 0.82f);
            Blur blur = new Blur(GraphicsDevice);


            //MENU
            startButton = new Start(SkiingGameCoursework.Content.StartButton, new Vector2(280, 60), SkiingGameCoursework.Content.StartButton.Width, SkiingGameCoursework.Content.StartButton.Height);
            HScore      = new HighestScore();

            mainGame.Active    = false;
            userPrompts.Active = false;
            menu.Active        = true;

            mainGame.LoadParticle();
            menu.LoadParticle();

            mainGame.Initialize();

            PlayBackgroundMusic();
        } //CREATES ALL THE INSTANCES OF ALL THE ASSETS
コード例 #28
0
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var snowballsCollection = new List <Snowball>();

        for (int i = 0; i < n; i++)
        {
            int snow            = int.Parse(Console.ReadLine());
            int time            = int.Parse(Console.ReadLine());
            int quality         = int.Parse(Console.ReadLine());
            var currentSnowball = new Snowball()
            {
                Snow    = snow,
                Time    = time,
                Quality = quality
            };
            snowballsCollection.Add(currentSnowball);
        }
        var result = snowballsCollection.OrderByDescending(ball => ball.Value).ThenByDescending(ball => ball.Snow).First();

        Console.WriteLine($"{result.Snow} : {result.Time} = {result.Value} ({result.Quality})");
    }
コード例 #29
0
ファイル: Snowball.cs プロジェクト: leosergkie/FFS2020_1
    void OnCollisionEnter2D(Collision2D collisionInfo)
    {
        Snowball sb = collisionInfo.gameObject.GetComponent <Snowball>();

        if (sb != null)
        {
            FixedJoint2D joint = gameObject.AddComponent <FixedJoint2D>();
            joint.connectedBody = sb.rb;
            joint.breakForce    = breakforce;
            joints.Add(joint);
            return;

            // Doesn't work yet
            Debug.Log((KineticEnergy() + sb.KineticEnergy()).magnitude);
            if ((KineticEnergy() + sb.KineticEnergy()).magnitude > mergeTreshold)
            {
                // FixedJoint2D joint = gameObject.AddComponent<FixedJoint2D>();
                joint.connectedBody = sb.rb;
                joint.breakForce    = breakforce;
                joints.Add(joint);
            }
        }
        SnowPile sp = collisionInfo.gameObject.GetComponent <SnowPile>();

        if (sp != null)
        {
            foreach (ContactPoint2D contact in collisionInfo.contacts)
            {
                Vector2 hitPoint = contact.point;
                // Instantiate(explosion,new Vector3(, hitPoint.y, 0), Quaternion.identity);

                if (sp.GetSnowFromPoint(hitPoint.x) > 0)
                {
                    Grow();
                }
            }
        }
    }
コード例 #30
0
        public override void Execute()
        {
            this.Initialization();

            if (!this.IsDone)
            {
                this.NextState = this;

                this.CheckForPause();

                this.PlaySound();

                // Creating Healthpacks
                foreach (var healthpack in StateMachine.CurrentLevel.ListOfHealthPacks)
                {
                    healthpack.Animation.Position = healthpack.Position;
                    healthpack.Bounds             = new Rectangle((int)healthpack.Position.X, (int)healthpack.Position.Y, healthpack.Animation.SourceRectangle.Width, healthpack.Animation.SourceRectangle.Height);
                    if (healthpack.IsActive)
                    {
                        if (!healthpack.IsDrawn)
                        {
                            this.SpritesInState.Add(healthpack.Animation);
                            healthpack.IsDrawn = true;
                        }

                        healthpack.ActOnPlayer(StateMachine.CurrentLevel.ListOfPlayers);
                    }
                    else
                    {
                        if (healthpack.IsDrawn)
                        {
                            this.SpritesInState.Remove(healthpack.Animation);
                            healthpack.IsDrawn = false;
                        }
                        else
                        {
                            if (healthpack.TimeToSpawn > 0)
                            {
                                healthpack.TimeToSpawn--;
                            }
                            else
                            {
                                healthpack.IsActive    = true;
                                healthpack.TimeToSpawn = Globals.Rng.Next(500, 1200);
                            }
                        }
                    }
                }

                // Using PileOfSnow
                foreach (var gameObject in StateMachine.CurrentLevel.ListOfGameObjects)
                {
                    if (gameObject.GetType() != typeof(Block))
                    {
                        gameObject.ActOnPlayer(StateMachine.CurrentLevel.ListOfPlayers);
                    }
                }

                for (int i = 0; i < StateMachine.CurrentLevel.ListOfPlayers.Count; i++)
                {
                    // Adjusting snowballbars
                    UIInitializer.ListOfSnowballBars[i].SourceRectangle = new Rectangle(UIInitializer.ListOfSnowballBars[i].SourceRectangle.X, UIInitializer.ListOfSnowballBars[i].SourceRectangle.Y, 20 * StateMachine.CurrentLevel.ListOfPlayers[i].Snowballs, UIInitializer.ListOfSnowballBars[i].SourceRectangle.Height);

                    // Adjusting Healthbars
                    UIInitializer.ListOfHealthbars1[i].SourceRectangle = new Rectangle(UIInitializer.ListOfHealthbars1[i].SourceRectangle.X, UIInitializer.ListOfHealthbars1[i].SourceRectangle.Y, 3 * StateMachine.CurrentLevel.ListOfPlayers[i].Health, UIInitializer.ListOfHealthbars1[i].SourceRectangle.Height);

                    // Game Over Condition
                    if (UIInitializer.ListOfHealthbars1[i].SourceRectangle.Width == 0)
                    {
                        this.IsDone    = true;
                        this.NextState = new GameOverState(this, i);
                        //// Stop sounds
                        for (int m = 1; m < 7; m++)
                        {
                            SoundManager.Stop("Sound" + m.ToString());
                        }
                    }

                    // Base Movement, Animation and Bounds
                    StateMachine.CurrentLevel.ListOfPlayers[i].Move(StateMachine.CurrentLevel.ListOfGameObjects);
                    StateMachine.CurrentLevel.ListOfPlayers[i].PlayerAnimation.Position      = StateMachine.CurrentLevel.ListOfPlayers[i].Position;
                    StateMachine.CurrentLevel.ListOfPlayers[i].PlayerAnimation.IsFacingRight = StateMachine.CurrentLevel.ListOfPlayers[i].IsFacingRight;
                    StateMachine.CurrentLevel.ListOfPlayers[i].Bounds = new Rectangle((int)StateMachine.CurrentLevel.ListOfPlayers[i].Position.X, (int)StateMachine.CurrentLevel.ListOfPlayers[i].Position.Y, StateMachine.CurrentLevel.ListOfPlayers[i].PlayerAnimation.SourceRectangle.Width, StateMachine.CurrentLevel.ListOfPlayers[i].PlayerAnimation.SourceRectangle.Height);
                    StateMachine.CurrentLevel.ListOfPlayers[i].PlayerAnimation.ChangeAnimation(StateMachine.CurrentLevel.ListOfPlayers[i].State);

                    // Shooting
                    if (StateMachine.CurrentLevel.ListOfPlayers[i].IsShooting)
                    {
                        StateMachine.CurrentLevel.ListOfPlayers[i].IsShooting = false;
                        Vector2 snowballPosition = new Vector2();
                        if (StateMachine.CurrentLevel.ListOfPlayers[i].IsFacingRight)
                        {
                            snowballPosition = new Vector2(StateMachine.CurrentLevel.ListOfPlayers[i].Bounds.Right, StateMachine.CurrentLevel.ListOfPlayers[i].Position.Y + (StateMachine.CurrentLevel.ListOfPlayers[i].Bounds.Height * 0.2f));
                        }
                        else
                        {
                            snowballPosition = new Vector2(StateMachine.CurrentLevel.ListOfPlayers[i].Bounds.Left - 40, StateMachine.CurrentLevel.ListOfPlayers[i].Position.Y + (StateMachine.CurrentLevel.ListOfPlayers[i].Bounds.Height * 0.2f));
                        }

                        Snowball newSnowball = new Snowball(snowballPosition, UIInitializer.CreateSprite("Snowball"), StateMachine.CurrentLevel.ListOfPlayers[i].IsFacingRight);
                        StateMachine.CurrentLevel.ListOfSnowballs.Add(newSnowball);
                        this.SpritesInState.Add(newSnowball.Sprite);
                    }
                }

                // Movement and Bounds of the Snowballs
                for (int i = 0; i < StateMachine.CurrentLevel.ListOfSnowballs.Count; i++)
                {
                    // Collision
                    StateMachine.CurrentLevel.ListOfSnowballs[i].ActOnPlayer(StateMachine.CurrentLevel.ListOfPlayers);

                    StateMachine.CurrentLevel.ListOfSnowballs[i].ActOnBlock(StateMachine.CurrentLevel.ListOfGameObjects);

                    // Movement and Destruction
                    if (!StateMachine.CurrentLevel.ListOfSnowballs[i].IsMelting)
                    {
                        StateMachine.CurrentLevel.ListOfSnowballs[i].Move();
                        StateMachine.CurrentLevel.ListOfSnowballs[i].Sprite.Position = StateMachine.CurrentLevel.ListOfSnowballs[i].Position;
                        StateMachine.CurrentLevel.ListOfSnowballs[i].Bounds          = new Rectangle(
                            (int)StateMachine.CurrentLevel.ListOfSnowballs[i].Position.X,
                            (int)StateMachine.CurrentLevel.ListOfSnowballs[i].Position.Y,
                            StateMachine.CurrentLevel.ListOfSnowballs[i].Sprite.Texture.Width,
                            StateMachine.CurrentLevel.ListOfSnowballs[i].Sprite.Texture.Height);
                    }
                    else
                    {
                        this.SpritesInState.Remove(StateMachine.CurrentLevel.ListOfSnowballs[i].Sprite);
                        StateMachine.CurrentLevel.ListOfSnowballs.Remove(StateMachine.CurrentLevel.ListOfSnowballs[i]);
                    }
                }
            }
        }
コード例 #31
0
        public static Entity CreateEntityCopy(Entity savedEntity, string tag = "EntitiesSavedButNotLoaded")
        {
            Entity loadedEntity = null;
            Type   savedType    = savedEntity.GetType();

            if (savedEntity.GetEntityData() != null)
            {
                // 一般 Entity 都是 EntityData + Vector2
                loadedEntity = (savedType.GetConstructor(new[] { typeof(EntityData), typeof(Vector2) })
                                ?.Invoke(new object[] { savedEntity.GetEntityData(), Vector2.Zero })) as Entity;

                if (loadedEntity == null)
                {
                    // 部分例如草莓则是 EntityData + Vector2 + EntityID
                    loadedEntity = savedType
                                   .GetConstructor(new[] { typeof(EntityData), typeof(Vector2), typeof(EntityID) })
                                   ?.Invoke(new object[] {
                        savedEntity.GetEntityData(), Vector2.Zero, savedEntity.GetEntityId2().EntityId
                    }) as Entity;
                }

                if (loadedEntity == null && savedType.IsType <CrystalStaticSpinner>())
                {
                    loadedEntity = new CrystalStaticSpinner(savedEntity.GetEntityData(), Vector2.Zero,
                                                            (CrystalColor)savedEntity.GetField(typeof(CrystalStaticSpinner), "color"));
                }

                if (loadedEntity == null && savedType.IsType <TriggerSpikes>())
                {
                    loadedEntity = new TriggerSpikes(savedEntity.GetEntityData(), Vector2.Zero,
                                                     (TriggerSpikes.Directions)savedEntity.GetField(typeof(TriggerSpikes), "direction"));
                }

                if (loadedEntity == null && savedType.IsType <Spikes>())
                {
                    loadedEntity = new Spikes(savedEntity.GetEntityData(), Vector2.Zero,
                                              ((Spikes)savedEntity).Direction);
                }

                if (loadedEntity == null && savedType.IsType <TriggerSpikes>())
                {
                    loadedEntity = new Spring(savedEntity.GetEntityData(), Vector2.Zero, ((Spring)savedEntity).Orientation);
                }

                if (loadedEntity != null)
                {
                    loadedEntity.Position = savedEntity.Position;
                    loadedEntity.CopyEntityData(savedEntity);
                    loadedEntity.CopyEntityId2(savedEntity);
                    return(loadedEntity);
                }
            }

            // TODO 如果是他们的子类该怎么办……
            if (savedType.IsType <BadelineDummy>())
            {
                loadedEntity = new BadelineDummy(savedEntity.GetStartPosition());
            }
            else if (savedType.IsType <AngryOshiro>())
            {
                loadedEntity = new AngryOshiro(savedEntity.GetStartPosition(),
                                               (bool)savedEntity.GetField("fromCutscene"));
            }
            else if (savedType.IsType <Snowball>())
            {
                loadedEntity = new Snowball();
            }
            else if (savedType.IsType <SlashFx>() && savedEntity is SlashFx slashFx)
            {
                loadedEntity = slashFx.Clone();
            }
            else if (savedType.IsType <SpeedRing>() && savedEntity is SpeedRing speedRing)
            {
                loadedEntity = speedRing.Clone();
            }
            else if (savedType.IsType <FinalBossShot>() && savedEntity is FinalBossShot finalBossShot)
            {
                loadedEntity = finalBossShot.Clone();
            }
            else if (savedType.IsType <FinalBossBeam>() && savedEntity is FinalBossBeam finalBossBeam)
            {
                loadedEntity = finalBossBeam.Clone();
            }
            else if (savedType.IsType <BirdTutorialGui>() && savedEntity is BirdTutorialGui birdTutorialGui)
            {
                loadedEntity = birdTutorialGui.Clone();
            }
            else if (savedType.IsType <SoundEmitter>() && savedEntity is SoundEmitter soundEmitter)
            {
                loadedEntity = SoundEmitter.Play(soundEmitter.Source.EventName,
                                                 new Entity(soundEmitter.Position));
                if (SoundSourceAction.PlayingSoundSources.FirstOrDefault(source =>
                                                                         source.EventName == soundEmitter.Source.EventName) == null)
                {
                    (loadedEntity as SoundEmitter)?.Source.TryCopyObject(soundEmitter.Source);
                }
                else
                {
                    (loadedEntity as SoundEmitter)?.Source.Stop();
                }
            }
            else if (savedType.IsType <Debris>() && savedEntity is Debris debris)
            {
                loadedEntity = Engine.Pooler.Create <Debris>()
                               .Init(debris.GetStartPosition(), (char)debris.GetField("tileset"),
                                     (bool)debris.GetField("playSound"));
            }
            else if (savedType == typeof(TalkComponent.TalkComponentUI))
            {
                // ignore
            }
            else if (savedType.IsType <Entity>())
            {
                loadedEntity = new Entity(savedEntity.GetStartPosition());
            }
            else
            {
                if (savedEntity.GetType().FullName == "Celeste.MoveBlock+Debris")
                {
                    loadedEntity = (savedEntity as Actor).CloneMoveBlockDebris();
                }
                else if (savedEntity.ForceCreateInstance(tag) is Entity newEntity)
                {
                    loadedEntity = newEntity;
                }
            }


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

            loadedEntity.Position = savedEntity.Position;
            loadedEntity.CopyEntityId2(savedEntity);
            loadedEntity.CopyStartPosition(savedEntity);

            return(loadedEntity);
        }