Example #1
0
        /// <summary>
        /// Resets the specified option.
        /// </summary>
        /// <param name="option">The option.</param>
        public virtual void Reset(ResetOption option)
        {
            DateTime currentDate   = DateTime.UtcNow.Date;
            DateTime lastResetDate = LastResetDate.Date;

            switch (option)
            {
            case ResetOption.OnMax:
                if (Value >= Max)
                {
                    Value         = Seed;
                    LastResetDate = currentDate;
                }
                break;

            case ResetOption.Daily:
                if (currentDate.Subtract(lastResetDate) > TimeSpan.Zero)
                {
                    Value         = Seed;
                    LastResetDate = currentDate;
                }
                break;

            case ResetOption.Weekly:
                var firstDateOfWeek = currentDate.GetFirstDateOfWeek();
                if (currentDate.Subtract(firstDateOfWeek) == TimeSpan.Zero)
                {
                    Value         = Seed;
                    LastResetDate = currentDate;
                }
                break;

            case ResetOption.Monthly:
                var firstDateOfMonth = currentDate.GetFirstDateOfMonth();
                if (currentDate.Subtract(firstDateOfMonth) == TimeSpan.Zero)
                {
                    Value         = Seed;
                    LastResetDate = currentDate;
                }
                break;

            case ResetOption.Yearly:
                var firstDateOfYear = new DateTime(currentDate.Year, 1, 1);
                if (currentDate.Subtract(firstDateOfYear) == TimeSpan.Zero)
                {
                    Value         = Seed;
                    LastResetDate = currentDate;
                }
                break;

            default:
                if (Value >= Max)
                {
                    Value         = Seed;
                    LastResetDate = currentDate;
                }
                break;
            }
        }
Example #2
0
//	public void submit(){
//
//		y = ansslot.GetComponentInChildren<Text> ().text ;
//		//Debug.Log (ansslot.GetComponentInChildren<Text> ().text);
//
//		if (y == gamesql.checker) {
//			correctAttack ();
//		} else {
//			wrongAttack();
//		}
//
//	}


    public void wrongAttack()
    {
//		gamesql.timer = 1f;
        //Fire when option is choosen.
        missile = missile.GetComponent <Missile> ();
        source.PlayOneShot(fly);
        missile.createShot();

        resetOpt = resetOpt.GetComponent <ResetOption> ();
        resetOpt.reset();

        gamesql.activation();
    }
Example #3
0
	public void P1WrongAttack(){
		//Fire when option is choosen. 
		missile = missile.GetComponent<Missile> ();
		source.PlayOneShot(fly);
		missile.createShot ();

		//reset the options back to original place. 
		resetOpt = resetOpt.GetComponent<ResetOption> ();
		resetOpt.reset ();
		resetOpt2 = resetOpt.GetComponent<ResetOption2> ();
		resetOpt2.reset ();
		
		gamesqlM.activation();
	}
Example #4
0
	public void P2WrongAttack(){
		//Fire when option is choosen. 
		fireBall = fireBall.GetComponent<FireBall> ();
		source.PlayOneShot(fireballsound);
		fireBall.createShot ();

		//reset the options back to original place. 
		resetOpt = resetOpt.GetComponent<ResetOption> ();
		resetOpt.reset ();
		resetOpt2 = resetOpt.GetComponent<ResetOption2> ();
		resetOpt2.reset ();
		
		gamesqlM.activation();
	}
Example #5
0
    public void correctAttack()
    {
//		gamesql.timer = 1f;
        //add one point
        scoreCount.correct();

        //Fire when option is choosen.
        fireBall = fireBall.GetComponent <FireBall> ();
        source.PlayOneShot(fireballsound);
        fireBall.createShot();

        //reset the options back to original place.
        resetOpt = resetOpt.GetComponent <ResetOption> ();
        resetOpt.reset();

        gamesql.activation();
    }