Example #1
0
 private void Awake()
 {
     mainCharacter = GameObject.Find("MainCharacter");
     mainCamera    = GameObject.Find("MainCamera");
     GetComponentsInChildren <LevelController>(levelsList);
     pointsCounter = GameObject.Find("PointsCanvas").GetComponent <PointsCounter>();
 }
        public void StorageService_IncorrectWithdrawForAccType_ThrowsException()
        {
            AccountOwner   owner   = new AccountOwner("Ilya", "Priv");
            IidGenerator   gen     = new IdGeneratorBIC();
            IPointsCounter counter = new PointsCounter();
            string         id      = service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter);

            Assert.Throws <ArgumentException>(() => service.Withdraw(id, 1000));
        }
Example #3
0
    private void Awake()
    {
        if (!Instance)
        {
            Instance = this;
        }

        pointsText = GetComponent <Text>();
    }
Example #4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
        public void StorageService_DeletingAccountTryingToGetDeletedInfo_ThrowsException()
        {
            AccountOwner   owner   = new AccountOwner("Ilya", "Priv");
            IidGenerator   gen     = new IdGeneratorBIC();
            IPointsCounter counter = new PointsCounter();
            string         id      = service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter);

            service.DeleteAccount(id);

            Assert.Throws <NullReferenceException>(() => service.AccInfo(id));
        }
Example #6
0
    void Awake()
    {
        // Load Data
        string resource = LoadResource.GetData();

        InsultsInstance = JsonUtility.FromJson <Insults>(resource);

        // Load Instances
        PointsManager = new PointsCounter(PlayerPointsText, ComputerPointsText);
        Computer      = new Machine(InsultsInstance);
        Turn          = new TurnManager();
    }
        public bool StorageService_WithdrawPointsCountInfoOutput_ExpectedResult(string info)
        {
            AccountOwner   owner   = new AccountOwner("Kirill", "Fidz");
            IidGenerator   gen     = new IdGeneratorBIC();
            IPointsCounter counter = new PointsCounter();
            string         id      = service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter);

            service.Deposit(id, 1000);
            string result = info.Replace("tochange", id);

            return(result == service.AccInfo(id));
        }
Example #8
0
    private void Awake()
    {
        DisplayCounter.SetActive(true);

        if (_instance != null && _instance != this)
        {
            Destroy(this);
        }
        else
        {
            _instance = this;
            DontDestroyOnLoad(this);
            HighScore.text                   = PlayerPrefs.GetInt("HighScore", 0).ToString();
            EnemyRocket.Destroyed           += EnemyRocketDestroyed;
            RocketSpawner.AllRocketsSpawned += CitySaved;
            RocketSpawner.GameOver          += CheckHighScore;
            Counter.text = _points.ToString();
        }
    }
Example #9
0
    public void PlayersReady()
    {
        if (!isServer)
        {
            return;
        }

        pointsCounter = new PointsCounter(firstPlayer, secondPlayer);

        firstPlayer.RpcSendMessage(new UIMessage(UIMessageType.Notification, "Let's get ready to rumble!!", 2f));
        secondPlayer.RpcSendMessage(new UIMessage(UIMessageType.Notification, "Let's get ready to rumble!!", 2f));

        firstPlayer.RpcSendMessage(new UIMessage(UIMessageType.Points, "0 : 0", 2f));
        secondPlayer.RpcSendMessage(new UIMessage(UIMessageType.Points, "0 : 0", 2f));

        ball = level.GetNextBall();

        LaunchBallInRandomDirection();
    }
        public bool StorageService_AccountsCreation_ExpectedResult(int length)
        {
            AccountOwner   owner = new AccountOwner("Kirill", "Fidz");
            IidGenerator   gen;
            IPointsCounter counter = new PointsCounter();

            if (length == 18)
            {
                gen = new IdGeneratorIBAN();
                return(length == service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter).Length);
            }
            else if (length == 32)
            {
                gen = new IdGeneratorBIC();
                return(length == service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter).Length);
            }
            else
            {
                throw new ArgumentException();
            }
        }
Example #11
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            // Services
            this.kinectService = WaveServices.GetService <KinectService>();

            // Scene Behaviors
            this.AddSceneBehavior(new GameSceneBehavior(), SceneBehavior.Order.PostUpdate);

            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil
            };                                                                                        // Transparent background need this clearFlags.

            this.EntityManager.Add(camera2D);

            // Initializes Players
            this.Players = new Player[this.kinectService.BodyCount];
            for (var i = 0; i < this.Players.Length; i++)
            {
                this.Players[i] = new Player(this)
                {
                    PlayerBody = this.kinectService.Bodies[i]
                };
            }

            // Initializes Smoke Emitters
            this.explosionEmitterCollection = new ExplosionEmitter[10];
            for (int i = 0; i < this.explosionEmitterCollection.Length; i++)
            {
                this.explosionEmitterCollection[i] = new ExplosionEmitter();
                this.EntityManager.Add(this.explosionEmitterCollection[i]);
            }

            // Timer
            this.TimeCounter = new TimeCounter();
            this.EntityManager.Add(this.TimeCounter);
            this.TimeCounter.CountDownBehavior.Start();

            // Points
            this.PointsCounter = new PointsCounter();
            this.EntityManager.Add(this.PointsCounter);
            this.PointsCounter.PointCounterBehavior.ResetPoints();

            // Falling Things Initializer!!!
            this.fallingBodies = new List <FallingBody>();
            int createdBodies = 0;

            Timer timer = null;

            timer = WaveServices.TimerFactory.CreateTimer(
                "CreateBallTimer",
                TimeSpan.FromSeconds(2f),
                () =>
            {
                // Calculates the next interval to drop a falling body.
                timer.Interval = TimeSpan.FromSeconds(WaveServices.Random.NextDouble());

                // Calculates the X position
                var fallingX = WaveServices.Random.Next((int)WaveServices.ViewportManager.LeftEdge + this.margin, (int)WaveServices.ViewportManager.RightEdge - this.margin);

                // Gets the first free body in pool
                var fallingBody = this.fallingBodies.FirstOrDefault(fb => !fb.IsInUse);

                // If there are not any free body we'll create one
                if (fallingBody == null)
                {
                    fallingBody = new FallingBody(fallingX, 1, createdBodies++);
                    this.EntityManager.Add(fallingBody);
                    this.fallingBodies.Add(fallingBody);
                }

                // Fall!!! I Command!!!
                fallingBody.Fall(fallingX);
            });
        }
Example #12
0
 void OnDestroy()
 {
     PointsCounter.GivePoints(pointValue);
 }
Example #13
0
 void Start()
 {
     scoreUI = GameObject.Find("Score").GetComponent <PointsCounter>();
 }
Example #14
0
 void Start()
 {
     _pointsCounter         = FindObjectOfType <PointsCounter>();
     _spriteRenderer        = gameObject.GetComponent <SpriteRenderer>();
     _spriteRenderer.sprite = sprites[Random.Range(0, sprites.Count)];
 }