Пример #1
0
 public override void Dispose()
 {
     if (!IsDisposed)
     {
         m_chain.Dispose();
         m_chain = null;
         BallAndChain.Dispose();
         BallAndChain = null;
         BallAndChain2.Dispose();
         BallAndChain2 = null;
         m_chainLinksList.Clear();
         m_chainLinksList = null;
         m_chainLinks2List.Clear();
         m_chainLinks2List = null;
         m_walkSound.Dispose();
         m_walkSound = null;
         m_walkSound2.Dispose();
         m_walkSound2 = null;
         base.Dispose();
     }
 }
Пример #2
0
 public override void Draw(Camera2D camera)
 {
     if (!IsKilled)
     {
         foreach (var current in m_chainLinksList)
         {
             m_chain.Position = current;
             m_chain.Draw(camera);
         }
         BallAndChain.Draw(camera);
         if (Difficulty > GameTypes.EnemyDifficulty.BASIC)
         {
             foreach (var current2 in m_chainLinks2List)
             {
                 m_chain.Position = current2;
                 m_chain.Draw(camera);
             }
             BallAndChain2.Draw(camera);
         }
     }
     base.Draw(camera);
 }
Пример #3
0
        public void PrintEntity(JObject entity, Map map, int px, int py)
        {
            GameWorld world  = map.World;
            string    type   = entity["name"].ToObject <string>();
            float     ox     = entity["x"].ToObject <float>();
            float     oy     = entity["y"].ToObject <float>();
            var       values = entity["values"];

            float x = px * 16 + ox;
            float y = py * 16 + oy;

            if (type == "ball_and_chain") //TODO: make a dictionary of (name -> generator delegate)
            {
                float rotation = entity["rotation"].ToObject <float>();
                float speed    = values["Speed"].ToObject <float>();
                float distance = values["Distance"].ToObject <float>();
                bool  swings   = values["Swings"].ToObject <bool>();

                var ballandchain = new BallAndChain(world, new Vector2(x, y), rotation, speed, distance);
                ballandchain.Swings = swings;
            }
            if (type == "moaiman")
            {
                bool flipped = entity["flippedX"].ToObject <bool>();
                var  moaiman = new MoaiMan(world, new Vector2(x, y));
                moaiman.Facing = flipped ? HorizontalFacing.Left : HorizontalFacing.Right;
            }
            if (type == "cannon")
            {
                float rotation = entity["rotation"].ToObject <float>();
                float delay    = values["Delay"].ToObject <float>();
                var   cannon   = new CannonFire(world, new Vector2(x, y), rotation);
                cannon.DelayTime = delay;
            }
            if (type == "cannon_fire")
            {
                float rotation = entity["rotation"].ToObject <float>();
                float delay    = values["Delay"].ToObject <float>();
                var   cannon   = new CannonFire(world, new Vector2(x, y), rotation);
                cannon.DelayTime = delay;
            }
            if (type == "cannon_poison")
            {
                float rotation = entity["rotation"].ToObject <float>();
                float delay    = values["Delay"].ToObject <float>();
                var   cannon   = new CannonPoisonBreath(world, new Vector2(x, y), rotation);
                cannon.DelayTime = delay;
            }
            if (type == "snake")
            {
                bool flipped = entity["flippedX"].ToObject <bool>();
                var  snake   = new Snake(world, new Vector2(x, y));
                snake.Facing = flipped ? HorizontalFacing.Left : HorizontalFacing.Right;
            }
            if (type == "hydra")
            {
                bool flipped = entity["flippedX"].ToObject <bool>();
                var  hydra   = new Hydra(world, new Vector2(x, y));
                hydra.Facing = flipped ? HorizontalFacing.Left : HorizontalFacing.Right;
            }
        }