Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LevelManager"/> class.
 /// </summary>
 /// <param name="gameDisplayResolution">The resolution the game is set to render at.</param>
 /// <param name="frameTime">The frame time set for the game.</param>
 public LevelManager(Vector2 gameDisplayResolution, float frameTime)
 {
     this.startText             = new RenderableText();
     this.Complete              = false;
     this.physicsWorld          = null;
     this.gameDisplayResolution = gameDisplayResolution;
     this.frameTime             = frameTime;
     this.physicsWorld          = null;
     this.spriteBatch           = null;
     this.floorSprite           = new Sprite();
     this.contentManager        = null;
     this.levelLoader           = null;
     this.floorEdges            = new List <Body>();
     this.visualFloorEdges      = new List <VisualEdge>();
     this.platforms             = new List <Platform>();
     this.interactiveEntities   = new List <InteractiveEntity>();
     this.stickman              = null;
     this.exit             = null;
     this.scrollingDeath   = null;
     this.mineCart         = null;
     this.cartSwitch       = null;
     this.scrollStartTimer = 0.0f;
     this.background       = new Background(this.gameDisplayResolution, 0.8f);
     this.maxScore         = 0.0f;
 }
Exemplo n.º 2
0
 void Start()
 {
     stickMan = FindObjectOfType <StickMan>();
     if (!stickMan)
     {
         Debug.LogError("Stick Man cannot be found!");
     }
 }
Exemplo n.º 3
0
    private void Awake()
    {
        _step         = 0;
        _stickm       = Camera.main.GetComponent <StickMan>();
        _TutorToolTip = GameObject.Find("TutorToolTip").GetComponent <TextMeshProUGUI>();
        _TutorBar     = GameObject.Find("TutorBar").GetComponent <Image>();
        _eventSender  = GameObject.FindObjectOfType <EventHand>();
        _eventSender.GameTimeChange += GameTimeChangeHandler;

        InvokeRepeating("RunGameTimer", 1, 1);
    }
Exemplo n.º 4
0
    void Start()
    {
        timeLeft     = 0;
        currentSpeed = Mathf.Log(3 * (Time.time + 2));
        ManageSpawnTiming();

        stickMan = FindObjectOfType <StickMan>();
        if (!stickMan)
        {
            Debug.LogError("Stick Man cannot be found!");
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// Loads the content used by entities in a level.
 /// </summary>
 /// <param name="contentManager">The content manager to load content with.</param>
 /// <param name="spriteBatch">The sprite batch to render using.</param>
 public void LoadContent(ContentManager contentManager, SpriteBatch spriteBatch)
 {
     this.CurrentLevelCustom = false;
     this.physicsWorld       = new World(ConvertUnits.ToSimUnits(new Vector2(0.0f, 348.8f)));
     this.contentManager     = contentManager;
     this.spriteBatch        = spriteBatch;
     this.startText.InitializeAndLoad(spriteBatch, this.contentManager, ContentLocations.SegoeUIFontLarge, EntityConstants.GoText);
     this.InitializeAndLoadSprites(this.spriteBatch, this.contentManager);
     this.levelLoader    = new LevelLoader(this.contentManager);
     this.stickman       = new StickMan(ref this.physicsWorld, 10.0f, 100, -1.0f, this.spriteBatch, this.contentManager);
     this.exit           = new Exit(spriteBatch, contentManager, ref this.physicsWorld, this.levelLoader.EndPosition);
     this.scrollingDeath = new ScrollingDeath(ref this.physicsWorld, this.gameDisplayResolution.Y, LevelConstants.MinimumScrollRate, LevelConstants.MaximumScrollRate, LevelConstants.ScrollRate, LevelConstants.ScrollAcceleration, LevelConstants.ScrollDeceleration, this.contentManager);
     this.rockyTerrain   = contentManager.Load <Texture2D>(ContentLocations.Scenery + ContentLocations.RockyTerrain);
     this.background.InitializeAndLoad(this.spriteBatch, this.contentManager, ContentLocations.RockyBackGround);
 }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     Target = Game.Inst.StickMan;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Loads the content used by entities in a level.
 /// </summary>
 /// <param name="contentManager">The content manager to load content with.</param>
 /// <param name="spriteBatch">The sprite batch to render using.</param>
 public void LoadContent(ContentManager contentManager, SpriteBatch spriteBatch)
 {
     this.CurrentLevelCustom = false;
     this.physicsWorld = new World(ConvertUnits.ToSimUnits(new Vector2(0.0f, 348.8f)));
     this.contentManager = contentManager;
     this.spriteBatch = spriteBatch;
     this.startText.InitializeAndLoad(spriteBatch, this.contentManager, ContentLocations.SegoeUIFontLarge, EntityConstants.GoText);
     this.InitializeAndLoadSprites(this.spriteBatch, this.contentManager);
     this.levelLoader = new LevelLoader(this.contentManager);
     this.stickman = new StickMan(ref this.physicsWorld, 10.0f, 100, -1.0f, this.spriteBatch, this.contentManager);
     this.exit = new Exit(spriteBatch, contentManager, ref this.physicsWorld, this.levelLoader.EndPosition);
     this.scrollingDeath = new ScrollingDeath(ref this.physicsWorld, this.gameDisplayResolution.Y, LevelConstants.MinimumScrollRate, LevelConstants.MaximumScrollRate, LevelConstants.ScrollRate, LevelConstants.ScrollAcceleration, LevelConstants.ScrollDeceleration, this.contentManager);
     this.rockyTerrain = contentManager.Load<Texture2D>(ContentLocations.Scenery + ContentLocations.RockyTerrain);
     this.background.InitializeAndLoad(this.spriteBatch, this.contentManager, ContentLocations.RockyBackGround);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LevelManager"/> class.
 /// </summary>
 /// <param name="gameDisplayResolution">The resolution the game is set to render at.</param>
 /// <param name="frameTime">The frame time set for the game.</param>
 public LevelManager(Vector2 gameDisplayResolution, float frameTime)
 {
     this.startText = new RenderableText();
     this.Complete = false;
     this.physicsWorld = null;
     this.gameDisplayResolution = gameDisplayResolution;
     this.frameTime = frameTime;
     this.physicsWorld = null;
     this.spriteBatch = null;
     this.floorSprite = new Sprite();
     this.contentManager = null;
     this.levelLoader = null;
     this.floorEdges = new List<Body>();
     this.visualFloorEdges = new List<VisualEdge>();
     this.platforms = new List<Platform>();
     this.interactiveEntities = new List<InteractiveEntity>();
     this.stickman = null;
     this.exit = null;
     this.scrollingDeath = null;
     this.mineCart = null;
     this.cartSwitch = null;
     this.scrollStartTimer = 0.0f;
     this.background = new Background(this.gameDisplayResolution, 0.8f);
     this.maxScore = 0.0f;
 }