/// <summary>
 /// Function that gets called when customer leaves the counter.
 /// </summary>
 /// <param name="score">Score that customer gives to player</param>
 /// <param name="timeRatio">Ratio of time consumed to Maximum wait time of customer</param>
 /// <param name="playerIds">List of Player IDs that gets affected by this score</param>
 /// <param name="npcController">NPC controller that is controlling the NPC</param>
 private void customerLeft(float score, float timeRatio, List <Guid> playerIds, NpcController npcController)
 {
     if (playerIds.Count == 0)
     {
         // Customer left after time out case
         foreach (KeyValuePair <Guid, BasicController> entry in playersList)
         {
             pushScoreToPlayer(score, entry.Value);
         }
     }
     else if (score > 0)
     {
         // Successfully served case
         BasicController controller = playersList[playerIds[0]];
         if (timeRatio <= 0.7f)
         {
             collectibleSpawner.spawnCollectible(playerIds[0]);
         }
         pushScoreToPlayer(score, controller);
     }
     else
     {
         // Failed with wrong combination,2x penalty
         foreach (Guid guid in playerIds)
         {
             BasicController controller = playersList[guid];
             pushScoreToPlayer(2 * score, controller);
         }
     }
 }
    /// <summary>
    /// Adds the provided score to player state and also spawns a flier that give player visual indication of score change
    /// </summary>
    /// <param name="score">Score of add</param>
    /// <param name="controller">Player Controller to which score needs to be added.</param>
    private void pushScoreToPlayer(float score, BasicController controller)
    {
        PlayerController playerController = (PlayerController)controller;

        playerController.PlayerState.addScore(score);
        spawnScoreFlier(score, playerController.GetControlledPawn.transform.position);
    }
 public MoveInRange(BasicController parent, BasicController target, float range)
 {
     m_parent = parent;
     m_target = target;
     m_range = range;
     m_agent = m_parent.GetComponent<NavMeshAgent>();
 }
Example #4
0
    public void dispatch(string UiName, string UiScript, Dictionary <string, string> param)
    {
        /*   Dictionary<string, string[]> l = new Dictionary<string, string[]>();
         * string[] d = new string[7];
         * d[0] = "prolo";
         * d[1] = "smic";
         * l.Add("khey", d);
         *
         * print();*/
        if (ActiveUi)
        {
            Destroy(ActiveUi);
        }

        ActiveUi     = Instantiate(UiMap[UiName]) as GameObject;
        ActiveUi.tag = "active";
        ActiveUi.transform.SetParent(gameObject.transform, false);


        BasicController UiController = ActiveUi.GetComponent(UiScript) as BasicController;

        UiController.setParams(param);
        UiController.apply();
        ActiveUi.transform.SetParent(gameObject.transform, false);
    }
Example #5
0
 private OServerEngine(bool useDefaultThread, int workThreadCount = 100)
 {
     ThreadPool.SetMinThreads(workThreadCount, Environment.ProcessorCount * 2);
     this.useDefaultThread = useDefaultThread;
     this.workThreadCount  = workThreadCount;
     this.userManager      = new UserManager();
     this.BasicController  = new BasicController(this.userManager);
 }
Example #6
0
        public MainPage()
        {
            var controller = new BasicController();

            this.DataContext = controller;
            this.ViewModel   = controller;
            this.InitializeComponent();
        }
 void Update()
 {
     if (Input.GetButtonDown("Fire1") && mouseOver)
     {
         playerNavMeshAgent.SetDestination(transform.position);
         BasicController aBasicController = playerGO.GetComponent <BasicController>();
         aBasicController.isMoving = true;
     }
 }
Example #8
0
    private void OnTriggerExit(Collider other)
    {
        BasicController controller = other.GetComponentInParent <BasicController>();

        if (controller != null)
        {
            exitEvent.Invoke();
        }
    }
Example #9
0
    private void OnTriggerExit(Collider other)
    {
        BasicController controller = other.GetComponentInParent <BasicController>();

        if (other.GetComponentInParent <BasicController>() != null)
        {
            controller.transform.parent = null;
        }
    }
 // Use this for initialization
 void Start()
 {
     m_sello                     = GetComponentInChildren <ParticleSystem>();
     m_controller                = m_handler.gameObject.GetComponent <FirstPersonController>();
     m_controller.enabled        = false;
     m_sombra_controller         = m_handler.gameObject.GetComponentInChildren <BasicController>();
     m_sombra_controller.enabled = true;
     m_oldPosition               = m_sombra_controller.transform.position;
 }
        public async Task GetAsync_ShouldReturnNotFoundGivenNoMatchingId()
        {
            _basicService.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(default(Basic));
            var controller = new BasicController(_basicService.Object);

            var result = await controller.GetAsync(It.IsAny <int>());

            result.Result.Should().BeOfType <NotFoundResult>();
        }
Example #12
0
    public void RpcAttack(GameObject go)
    {
        /*if (isLocalPlayer)
         * {*/
        BasicController playerController = go.GetComponent <BasicController>();

        playerController.DecreaseLives();
        playerController.Respawn(Vector3.zero);
        /* }*/
    }
Example #13
0
        public TestBasicController(ITestOutputHelper _testOutputHelper)
        {
            this._testOutputHelper = _testOutputHelper;
            var optionsBuilder = new DbContextOptionsBuilder <MySqliteDBContext>();

            optionsBuilder.UseSqlite(@"Data Source=/Users/Konstantin/Desktop/Projects/Demo.Asp.Net/Demo.Test/bin/Debug/netcoreapp2.1/blogging.db");
            MySqliteDBContext db = new MySqliteDBContext(optionsBuilder.Options);

            controller = new BasicController(db);
        }
Example #14
0
 public void Initialize()
 {
     mockBlueprintBuilder            = new Mock <IBlueprintBuilder>();
     mockTableHighlighter            = new Mock <ITableHighlighter>();
     masterController                = new MasterController(null, null, mockTableHighlighter.Object);
     pipeBuildController             = new PipeBuildController(masterController, mockBlueprintBuilder.Object, new CoordinatePair());
     controller                      = new BasicController(masterController, pipeBuildController, mockBlueprintBuilder.Object);
     masterController.BaseController = controller;
     masterController.Reset();
 }
Example #15
0
    void Update()
    {
        if (Input.GetButtonDown("Fire1") && mouseOver)
        {
            LevelManager aLevelManager = aLevelManagerObject.GetComponentInChildren <LevelManager>();
            aLevelManager.onlyTargetHasCoolider(Int32.Parse(levelName));

            playerNavMeshAgent.SetDestination(transform.position);
            BasicController aBasicController = playerGO.GetComponent <BasicController>();
            aBasicController.isMoving = true;
        }
    }
Example #16
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.layer == 9)
     {
         BasicController playerController = collision.gameObject.GetComponent <BasicController>();
         playerController.DecreaseLives();
         playerController.Respawn(Vector3.zero);
     }
     else
     {
         collision.gameObject.SetActive(false);
     }
 }
Example #17
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == Target.tag)
     {
         BasicController TargetCharacter = collision.gameObject.GetComponent <BasicController>();
         if (TargetCharacter != null)
         {
             TargetCharacter.Hurt(Damage);
             Instantiate(Explosion, transform.position, transform.rotation);
             Destroy(gameObject);
         }
     }
 }
Example #18
0
        public void it_should_create_complex_controller_instance()
        {
            var controller = new BasicController();

            _container.Setup(instance => instance.CanResolve(typeof(BasicController), null)).Returns(false);
            _container.Setup(instance => instance.Resolve(typeof(IController), null)).Returns(controller);

            var result = _activator.CreateInstance(typeof(BasicController));

            result.Should().Be(controller);
            _container.Verify(instance => instance.CanResolve(typeof(BasicController), null));
            _container.Verify(instance => instance.Resolve(typeof(IController), null));
        }
Example #19
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         BasicController Player = collision.gameObject.GetComponent <BasicController>();
         if (Player != null)      // Если ссылка не пуста
         {
             Player.Hurt(Damage); // Вызываем метод урона и указываем его размер
             Instantiate(BOOM, transform.position, transform.rotation);
             Destroy(gameObject);
         }
     }
 }
Example #20
0
        void Start()
        {
            basicController = GetComponent <BasicController>();
            CollisionManager collisionManager = GetComponent <CollisionManager>() ?? GetComponentInChildren <CollisionManager>();

            collisionManager.onHit(temporaryFreeze);
            rigidbody = GetComponent <Rigidbody>();
            originalRigidbodyConstraints = rigidbody.constraints;
            if (target == null)
            {
                target = GameObject.FindGameObjectWithTag(TARGET_TAG).transform;
            }
        }
Example #21
0
 void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.layer == 9)
     {
         BasicController playerController = col.gameObject.GetComponent <BasicController>();
         playerController.Respawn(MoleficentGameManager.instance.LastCheckPoint());
         //Debug.Log("sono nell'if del respawner.cs");
     }
     else
     {
         // Debug.Log("sono nell'else del respawner.cs");
         col.gameObject.SetActive(false);
     }
 }
        public async Task GetAsync_ShoulrReturnBasicGivenId()
        {
            var list       = new Fixture().CreateMany <Basic>();
            var firstBasic = list.FirstOrDefault();

            _basicService.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(firstBasic);
            var controller = new BasicController(_basicService.Object);

            var actionResult = await controller.GetAsync(It.IsAny <int>());

            actionResult.Should().BeOfType <ActionResult <Basic> >();
            var result = actionResult.Result as OkObjectResult;

            result.Value.Should().Be(firstBasic);
        }
 public object MoleIsAlive(object o)
 {
     foreach (GameObject go in FindObjectsOfType <GameObject>())
     {
         if (playerTags.Contains(go.tag))
         {
             BasicController bc = go.GetComponent <BasicController>();
             if (bc.checkIsMole())
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        public async Task GetAllAsync_ShoulrReturnAll()
        {
            var list = new Fixture().CreateMany <Basic>();

            _basicService.Setup(x => x.GetAllAsync()).ReturnsAsync(list);
            var controller = new BasicController(_basicService.Object);

            var actionResult = await controller.GetAllAsync();

            actionResult.Should().BeOfType <ActionResult <IEnumerable <Basic> > >();
            var result = actionResult.Result as OkObjectResult;
            var values = result.Value as IEnumerable <Basic>;

            values.Should().HaveCount(list.Count());
        }
    private void FrontAttack()
    {
        transform.GetChild(1).GetComponent <ParticleSystem>().Play();
        //fa perdere una vita al giocatore in range B davanti a sè e lo fa respawnare
        RaycastHit hit;

        if (Physics.SphereCast(transform.position + new Vector3(0, 1, 0), .5f, transform.forward, out hit, distanceB))
        {
            if (playerTags.Contains(hit.transform.tag))
            {
                BasicController playerController = hit.transform.gameObject.GetComponent <BasicController>();
                playerController.DecreaseLives();
                playerController.Respawn(Vector3.zero);
            }
        }
    }
Example #26
0
    private void Start()
    {
        instance = this;
        UpdateUI();
        VsnAudioManager.instance.PlayMusic("song_intro", "song_loop");

        if (VsnSaveSystem.GetIntVariable("minigame_played") == 0)
        {
            VsnController.instance.StartVSN("intro");
        }
        else
        {
            VsnSaveSystem.SetVariable("minigame_played", 0);
            VsnController.instance.StartVSN("return_minigame");
        }
    }
Example #27
0
        public void Initialize()
        {
            mockBlock        = new Mock <IBlock>();
            doubleEdgedPipes = new List <DoubleEdgedPipe>();
            mockBlock.SetupGet(block => block.PipesWithBothEdges).Returns(doubleEdgedPipes);
            connectingPipes = new List <ConnectingPipe>();
            mockBlock.SetupGet(block => block.PipesWithOneEdge).Returns(connectingPipes);

            mockBlueprintBuilder            = new Mock <IBlueprintBuilder>();
            mockHighlighter                 = new Mock <ITableHighlighter>();
            masterController                = new MasterController(null, null, mockHighlighter.Object);
            pipeBuildController             = new PipeBuildController(masterController, mockBlueprintBuilder.Object, new CoordinatePair());
            basicController                 = new BasicController(masterController, pipeBuildController, mockBlueprintBuilder.Object);
            masterController.BaseController = basicController;
            masterController.Reset();
        }
 private void RoundAttack()
 {
     transform.GetChild(0).GetComponent <ParticleSystem>().Play();
     //fa perdere una vita ai giocatori in range B e li fa respawnare
     foreach (GameObject go in FindObjectsOfType <GameObject>())
     {
         if (playerTags.Contains(go.tag))
         {
             if ((transform.position - go.transform.position).magnitude <= distanceB)
             {
                 BasicController playerController = go.GetComponent <BasicController>();
                 playerController.DecreaseLives();
                 playerController.Respawn(Vector3.zero);
             }
         }
     }
 }
Example #29
0
        public void Setup()
        {
            _config = new HttpConfiguration();

            // configuration to allow for route/link-gen testing
            _config.MapHttpAttributeRoutes();
            _config.EnsureInitialized();

            _controller = new BasicController
            {
                Request       = new HttpRequestMessage(),
                Configuration = _config
            };

            _controller.Request.RequestUri = new Uri(FakeBaseAddress); // effectively set the Base URL so Url.Link() can produce fq hrefs

            _server = new HttpServer(_config);
            _client = new HttpClient(_server);
        }
    /// <summary>
    /// tests if the mouse is over a unit and returns true if it is
    /// </summary>
    /// <param name="cont">the unit that the mosue was over, this is an out param</param>
    /// <returns>true if the mouse was over a unit false otherwise</returns>
    private bool isOverUnit(out BasicController cont)
    {
        Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hitInfo;

        BasicController retval = null;
        if (Physics.Raycast(mouseRay, out hitInfo))
        {
            retval = hitInfo.collider.gameObject.GetComponent<BasicController>();
        }
        //will return null if we did not hit anything
        if (retval != null)
        {
            cont = retval;
            return true;
        }
        else
        {
            cont = null;
            return false;
        }
    }
Example #31
0
        private void cmd_start_stop_click(object sender, RoutedEventArgs e)
        {
            if (cmd_start_stop.Content.Equals("Start"))
            {
                if (BasicController.GetInstance(this, tb_Bot_ID.Text, tb_Username.Text).StartBot())
                {
                    StartStopBotUI(true);
                }
                else
                {
                    StartStopBotUI(false);
                }

                Properties.Settings.Default.Save();
            }
            else
            {
                if (BasicController.GetInstance(this, tb_Username.Text, tb_Bot_ID.Text).StopBot())
                {
                    StartStopBotUI(false);
                }
            }
        }
Example #32
0
        public void Setup()
        {
            _controller = new BasicController
            {
                Request = new HttpRequestMessage()
            };

            var config = new HttpConfiguration();

            // configuration to allow for route/link-gen testing
            config.MapHttpAttributeRoutes();
            config.EnsureInitialized();

            config.Formatters.Clear();
            config.Formatters.Add(new HalJsonMediaTypeFormatter());
            config.Formatters.Add(new XmlMediaTypeFormatter());
            config.Formatters.Add(new JQueryMvcFormUrlEncodedFormatter(config));

            _server = new HttpServer(config);

            _controller.Configuration = config;

            _controller.Request.RequestUri = new Uri(FakeBaseAddress); // effectively set the Base URL so Url.Link() can produce fq hrefs
        }
 public AttackTarget(CommandManager parent, BasicController target)
 {
     m_parent = parent.ParentController;
     m_target = target;
     m_parentController = parent;
 }
 // Use this for initialization
 void Start()
 {
     controller = (BasicController) this.gameObject.GetComponent(typeof(BasicController));
 }