Esempio n. 1
0
    public void DoAction()
    {
        Splittable cube = gameObject.GetComponent <Splittable> ();

        if (cube)
        {
            cube.Split();
        }
        Spawner spawn = gameObject.GetComponent <Spawner> ();

        if (spawn)
        {
            spawn.Spawn();
        }
        Sweeper sweep = gameObject.GetComponent <Sweeper> ();

        if (sweep)
        {
            sweep.Sweep();
        }
        Shotgun shotgun = gameObject.GetComponent <Shotgun> ();

        if (shotgun)
        {
            shotgun.Shoot();
        }
    }
Esempio n. 2
0
 private void SweepCheck()
 {
     if (_topDict._sweepRequests == 0)
     {
         _topDict._sweepRequests = 1;
         Sweeper.TryRearm(this);
     }
 }
Esempio n. 3
0
 // FixedUpdate is called once for physics frame
 void FixedUpdate()
 {
     if (CurrentGameState == GameState.SWEEPING)
     {
         ActiveRock.GetComponent <Rock>().UseReducedFriction = Utils.GetKey_Confirm();
         if (Utils.GetKey_Confirm())
         {
             Rigidbody2D rb = ActiveRock.GetComponent <Rigidbody2D>();
             rb.velocity += new Vector2(0f, Sweeper.GetComponent <Sweeper>().SweepOffset.y *rb.velocity.magnitude *SWEEP_COEF);
         }
     }
 }
Esempio n. 4
0
        public void AddBombsToGrid_AddsCorrectNumberOfBombs(int width, int height, int totalBombs)
        {
            //arrange
            var sweeper = new Sweeper(width, height);

            //act
            sweeper.AddBombsToGrid(totalBombs);

            //assert
            var actualBombs = sweeper.GetTtotalBombs();

            Assert.That(actualBombs, Is.EqualTo(totalBombs));
        }
Esempio n. 5
0
        private static Sweeper SetupBoardBasedOnUserInput()
        {
            Console.Clear();
            Console.WriteLine("Enter Length:");
            int length = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Enter Height:");
            int height = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Enter Total Bombs:");
            int totalBombs = Int32.Parse(Console.ReadLine());

            var sweeper = new Sweeper(length, height);

            sweeper.AddBombsToGrid(totalBombs);
            return(sweeper);
        }
Esempio n. 6
0
        public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, TraceWriter log)
        {
            log.Info($"TTLSweeper function started at: {DateTime.Now}");
            CronConfiguration.LocadConfig();
            Sweeper sweeper = new Sweeper(log);

            try
            {
                sweeper.RunSweeper();
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }

            log.Info($"TTLSweeper function ended at: {DateTime.Now}");
        }
Esempio n. 7
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        boardScript     = GetComponent <BoardManager>();
        meleeUnitScript = GetComponent <MeleeUnitManager>();
        logicScript     = GetComponent <LogicManager>();
        sweeperScript   = GetComponent <Sweeper>();
        InitGame();
    }
Esempio n. 8
0
    void Awake()
    {
        source            = GetComponent <AudioSource>();
        player            = FindObjectOfType <Player>();
        sweeper           = FindObjectOfType <Sweeper>();
        lives             = startingLives;
        roundTime         = 0;
        enemiesSpawned    = 0;
        spawnPositions    = new Vector2[4];
        spawnPositions[0] = new Vector2(-5.15f, 2.8f);
        spawnPositions[1] = new Vector2(5.15f, 2.8f);
        spawnPositions[2] = new Vector2(-5f, -2.51f);
        spawnPositions[3] = new Vector2(5f, -2.51f);

        spawnRotations    = new float[4];
        spawnRotations[0] = -135;
        spawnRotations[1] = 135;
        spawnRotations[2] = -45;
        spawnRotations[3] = 45;
    }
Esempio n. 9
0
 void StartThrow()
 {
     ActiveRock = Instantiate(RockPrefab);
     rocks.Add(ActiveRock);
     ActiveRock.GetComponent <Rock>().Team    = GetCurrentTeam();
     ActiveRock.GetComponent <Rock>().Minimap = Minimap;
     ActiveRock.GetComponent <Rock>().InstantiateIndicator();
     Thrower.GetComponent <SpriteRenderer>().sprite = GetCurrentTeam().AimSprite;
     Sweeper.GetComponent <SpriteRenderer>().sprite = GetCurrentTeam().SweepSprite;
     Sweeper.GetComponent <Sweeper>().ResetOffsets();
     trajectory          = Instantiate(TrajectoryPrefab);
     trajectoryIndicator = Instantiate(TrajectoryIndicatorPrefab);
     trajectory.transform.SetParent(ActiveRock.transform);
     trajectoryIndicator.transform.SetParent(ActiveRock.GetComponent <Rock>().Indicator.transform);
     trajectory.transform.localPosition          = new Vector3();
     trajectoryIndicator.transform.localPosition = new Vector3();
     CurrentGameState = GameState.AIMING;
     if (CurrentTurn == Turn.P1 ? GameConfig.P1ShowTutorial : GameConfig.P2ShowTutorial)
     {
         helpStage = HelpScreen.ID.SCORING;
     }
 }
Esempio n. 10
0
 private void SetUpGrid(int length, int height)
 {
     _sweeper = new Sweeper(length, height);
 }
Esempio n. 11
0
 public GameView(Sweeper sweeper)
 {
     _sweeper = sweeper;
 }