Exemplo n.º 1
0
        internal override void updateCollisionWith(Entity a_collider)
        {
            if (m_hasSaved && a_collider is Player)
            {
                Player t_player = (Player)a_collider;
                if(CollisionManager.Collides(this.getHitBox(), a_collider.getHitBox()))
                {
                    //if (KeyboardHandler.isKeyPressed(GameState.getActionKey()) && Game.getInstance().getState() is GameState)
                    //{
                        Level tLevel = new Level();
                        tLevel.setLevelObjects(Game.getInstance().getState().getObjectList());
                        tLevel.setEvents(((GameState)Game.getInstance().getState()).getEvents());

                        Serializer.getInstance().SaveLevel(Game.getInstance().getCheckPointLevel(true), tLevel);
                        Serializer.getInstance().saveGame(Game.getInstance().getCheckPointProgress(true), Game.getInstance().getProgress());
                        m_hasSaved = false;

                        String t_textureName = "Images//GUI//GameGUI//checkpoint";
                        m_feedback = new Particle(new CartesianCoordinate(Vector2.Zero, Game.getInstance().m_camera.getPosition()), t_textureName, 33, 0.0015f);
                        m_feedback.getPosition().setLocalCartesian(new Vector2(0, -100) - m_feedback.getImg().getSize() / 2);
                        m_feedback.setTimer(((float)Game.getInstance().getTotalGameTime().TotalMilliseconds) + 3000f);
                        Game.getInstance().getState().addObject(m_feedback);

                    /*}
                    else
                    {
                        t_player.setInteractionVisibility(true);
                    }*/
                }
            }
        }
Exemplo n.º 2
0
 protected override bool collect()
 {
     int t_num = 4 - ((GameState)Game.getInstance().getState()).numberOfGoals();
     if (t_num > 0 && t_num < 4)
     {
         String t_textureName = "Images//GUI//GameGUI//stolen" + t_num + "of3";
         m_feedback = new Particle(new CartesianCoordinate(Vector2.Zero, Game.getInstance().m_camera.getPosition()), t_textureName, 33, 0.0015f);
         m_feedback.getPosition().setLocalCartesian(new Vector2(0,-200)-m_feedback.getImg().getSize() / 2);
         m_feedback.setTimer(((float)Game.getInstance().getTotalGameTime().TotalMilliseconds) + 3000f);
         Game.getInstance().getState().addObject(m_feedback);
     }
     return true;
 }