Beispiel #1
0
    void SetupLevel(int difficulty)
    {
        difficultyLevel = difficulty;
        levelData       = ResourceManager.LoadChaseLevel(difficultyLevel);
        if (levelData == null)
        {
            PlaySessionManager.instance.CompleteDream(false, 0, 0, 0f);
            return;
        }
        player.speed = levelData.playerSpeed;
        goalPosition = new Vector2(
            goal.transform.position.x,
            goal.transform.position.z);
        originalPosition = new Vector2(
            player.transform.position.x,
            player.transform.position.z);
        originalDistance = Vector2.Distance(
            goalPosition,
            originalPosition);

        float   playerZ         = player.transform.position.z;
        float   wallSize        = doomWall.GetComponent <Renderer>().bounds.size.z / 2;
        Vector3 newDoomPosition = doomWall.transform.position;

        newDoomPosition.z           = playerZ - levelData.wallStartDistance;
        newDoomPosition.z          -= wallSize;
        doomWall.transform.position = newDoomPosition;
        doomWall.speed = levelData.wallSpeed;

        CountdownClock.InitializeAndStart(
            levelData.timerMinutes,
            levelData.timerSeconds);
    }
Beispiel #2
0
    void SetupLevel()
    {
        // Skills.
        SkillData[] chosenSkills = PlayerPrefsManager.LoadPlayerSkills();
        uiSkillManager.InitializeAndEnable(chosenSkills);

        // Input.
        BattleClassType typeToUse = PlayerPrefsManager.LoadSelectedClass();

        playerClass = ResourceManager.LoadBattleClass(typeToUse);
        Debug.Log("class selected: " + playerClass.className);
        inputManager.InitializeAndMonitor(playerClass, chosenSkills);

        // Health.
        healthManager.InitializeStats(levelData.playerHp, playerClass.def);

        // Enemy.
        spawnManager.InitializeAndStartSpawning(
            levelData.typeToSpawn,
            levelData.respawnTime);

        // Clock.
        CountdownClock.InitializeAndStart(
            levelData.timerMinutes,
            levelData.timerSeconds);
    }
Beispiel #3
0
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            if (null != CountdownClock)
            {
                CountdownClock.Update(gameTime);
            }

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
Beispiel #4
0
 private void _CountDownTimer_Tick(object sender, EventArgs e)
 {
     _counter--;
     CountdownClock.Text = _hours.ToString("00") + ":" + _counter.ToString("00");
     CountdownClock.Refresh();
     if (_counter == 0)
     {
         _CountDownTimer.Stop();
         CountdownClock.Text = _hours.ToString("00") + ":" + _counter.ToString("00");
         DialogResult        = DialogResult.OK;
     }
 }
Beispiel #5
0
 void EndScene()
 {
     SurvivalEnemySpawnManager.DisableSpawning();
     SurvivalEnemyAI.DisableAttack();
     foreach (Transform enemy in enemyFolder)
     {
         enemy.GetComponent <SurvivalEnemyAI>().enabled = false;
     }
     player.enabled = false;
     CountdownClock.RequestStopClock();
     CountdownClock.OnTimeEnd -= EndScene;
 }
Beispiel #6
0
 void CompleteAndEnd(bool completed)
 {
     CountdownClock.RequestStopClock();
     CountdownClock.OnTimeEnd -= EndScene;
     player.CancelInvoke();
     player.enabled = false;
     PlaySessionManager.instance.CompleteDream(
         completed,
         clock.GetRemainingMin() * 60 + clock.GetRemainingSec(),
         levelData.timerMinutes * 60 + levelData.timerSeconds,
         levelProgress
         );
 }
Beispiel #7
0
        static void Main()
        {
            var clock     = new CountdownClock();
            var bath      = new Bathroom();
            var microwave = new Microwave();

            bath.Register(clock);
            microwave.Register(clock);
            Console.WriteLine("The countdown has begun!");
            clock.ImitationCountdownClock(5);
            bath.Unregister(clock);
            clock.ImitationCountdownClock(2);
            Console.ReadKey();
        }
        public static void Main(string[] args)
        {
            var clock = new CountdownClock(5000, "Hello", "xyz");

            clock.Start();

            clock.Elapsed += (sender, eventArgs) =>
            {
                Console.WriteLine(eventArgs.Message);
                if (eventArgs.AdditionalInfo != null)
                {
                    Console.WriteLine(eventArgs.AdditionalInfo);
                }
            };

            Console.ReadKey();
        }
Beispiel #9
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            //draw the meters
            meterRenderer.Alpha = Transition.Alpha;
            meterRenderer.SpriteBatchBegin(ScreenManager.SpriteBatch, Resolution.TransformationMatrix());
            if (!QuestionScreen.AnswerChosen)
            {
                CountdownClock.Draw(AutoQuit.RemainingTime, meterRenderer, ScreenManager.SpriteBatch);
            }
            else if (QuestionScreen.TimeRanOut)
            {
                CountdownClock.Draw(0f, meterRenderer, ScreenManager.SpriteBatch);
            }
            else
            {
                CountdownClock.Draw(QuestionTime, meterRenderer, ScreenManager.SpriteBatch);
            }
            ScreenManager.SpriteBatch.End();
        }
Beispiel #10
0
    void Awake()
    {
        // TODO: get a reference to the countdown clock
        cursor         = transform.FindChild("cursor").gameObject;
        body           = cursor.GetComponent <Rigidbody2D>() as Rigidbody2D;
        spriteRenderer = this.GetComponent <SpriteRenderer>() as SpriteRenderer;
        countdownClock = transform.GetComponentInChildren <CountdownClock>();

        if (playerNumber != 1)
        {
            horizontalAxis = "Horizontal2";
            verticalAxis   = "Vertical2";
            dropButton     = "Drop2";
            playerColor    = new Color(255f / 255f, 180f / 255f, 180f / 255f);
            cursor.GetComponent <SpriteRenderer>().color = playerColor;
        }
        else
        {
            playerColor = new Color(180f / 255f, 180f / 255f, 255f / 255f);
            cursor.GetComponent <SpriteRenderer>().color = playerColor;
        }
    }
    void SetupLevel(int difficulty)
    {
        difficultyLevel = difficulty;
        levelData       = ResourceManager.LoadFallLevel(difficultyLevel);

        if (levelData == null)
        {
            PlaySessionManager.instance.CompleteDream(0, 0);
            return;
        }
        ClearRings();
        RingMovement.movementSpeed = levelData.ringMovementSpeed;
        player.transform.position  = new Vector3(-1f, 0f, 1f);

        // Generate Rings
        for (int i = 0; i < levelData.maxConcurrentRings; ++i)
        {
            AddRing();
        }

        CountdownClock.InitializeAndStart(
            levelData.timerMinutes,
            levelData.timerSeconds);
    }
Beispiel #12
0
 void Start()
 {
     countdownClock = transform.parent.parent.GetComponentInChildren <CountdownClock>();
 }