private void RouletteSelect(ref List <Gene> genes, EnvironmentController environmentController, float SP) { List <float> values = new List <float>(); for (int i = 0; i < selectedSize; ++i) { float val = (float)Random.Range(0, 100) / 100; values.Add(val); } var rankedGenes = RankFitness(genes, environmentController, SP); List <Gene> ans = new List <Gene>(); foreach (float val in values) { foreach (var(gene, f) in rankedGenes) { if (val < f) { ans.Add(gene); break; } } } genes = ans; }
private void Start() { _settingsReader = SettingsReader.GetInstance(); _environment = EnvironmentController.GetInstance(); VariablesInit(); }
// Load actorA saved game public void Load() { print("Loading..."); StorageHandler sh = new StorageHandler(); PlayerData dp = (PlayerData)sh.LoadData("player") as PlayerData; _pd = dp; PlayerDataTracker pdt = PlayerDataTracker.GetInstance(); pdt.Dt = _pd; PlayerPrefab = Instantiate(PlayerPrefab, new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY(), pdt.GetPlayerZ()), Quaternion.identity); PlayerPrefab.gameObject.name = "Player"; this.gameObject.GetComponent <EnvironmentColours>().Player = PlayerPrefab; C.transform.position = new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY() + 10, pdt.GetPlayerZ()); C.transform.parent = PlayerPrefab.transform; _dta = TempDataTracker.GetInstance(); _settingsReader = SettingsReader.GetInstance(); _cam = GameObject.Find("Main Camera"); _environmentController = EnvironmentController.GetInstance(); _gm = GeneticsManager.GetInstance(); _co = CollisionMediator.GetInstance(); _am = AudioManager.GetInstance(); }
public void CmdUpdateEnvironment() { Debug.Log("CMD: Updating Environment"); EnvironmentController controller = gameManager.GetComponent <EnvironmentController>(); RpcUpdateEnvironment(controller.timeMultiplier, controller.currentTimeOfDay, controller.days, controller.secondsInFullDay, controller.temperature, controller.windSpeed, controller.windAngle); }
// Setup void Start() { //Movement setup motor = GetComponent <PlayerMotor>(); attributes = GetComponent <Attributes>(); waypointManager = transform.root.GetChild(2).GetComponent <WaypointManager>(); inventory = transform.root.GetChild(1).GetChild(6).GetComponent <InventoryUI>(); mapgen = transform.root.GetChild(4).GetComponent <MapGenerator>(); Crosshair = transform.root.GetChild(1).GetChild(3).GetComponent <Image>(); sm = transform.root.GetChild(5).GetComponent <SaveManager>(); ec = transform.root.GetChild(5).GetComponent <EnvironmentController>(); postProcessingVolume = transform.root.GetChild(7).GetComponent <PostProcessVolume>(); pausePanel = transform.root.GetChild(1).GetChild(5).gameObject; Cursor.lockState = CursorLockMode.Locked; Crosshair.gameObject.SetActive(true); //Generate map if new game if (WorldData.isNewMap == true) { mapgen.GenerateMap(mapgen.seed); } else { //Otherwise, load the game sm.LoadGame(); } //Save the game upon world generation sm.SaveGame(); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); environment = FindObjectOfType <EnvironmentController>(); renderer = GetComponent <Renderer>(); currentHealth = totalHealth; }
private void Start() { EC = EnvironmentController.instance; if (isEnemySpawneable) { float isEnemy = Random.Range(0, 3); if (isEnemy <= 1) { CreateNewEnemy(); } } if (isTrapSpawneable) { float isTrap = Random.Range(0, 10); if (isTrap <= 1) { CreateNewTrap(); } } try { if (isCave == false) { CreateNewDeco(numberOfDeco); } } catch (System.Exception) { throw; } }
void Start() { player = GameObject.FindWithTag("Player"); environmentParent = GameObject.FindWithTag("EnvParent"); pi = player.GetComponent <PlayerInput>(); ec = gameObject.GetComponent <EnvironmentController>(); }
private void Awake() { this.environmentController = new EnvironmentController(this.playerPrefab); this.inputController = new InputController(); this.audioController = new AudioController(); Debug.Log("Game Controller Initialized!\n----------------------------"); }
public override string ToJson() { Serializer serializer = Serializer.Start(); serializer.AddString("playerId", base.PlayerId); if (this.LocalePreference != null) { serializer.AddString("locale", this.LocalePreference); } if (this.DeviceToken != null) { serializer.AddString("deviceToken", this.DeviceToken); } serializer.AddString("deviceType", "f"); serializer.Add <double>("timeZoneOffset", this.TimeZoneOffset); EnvironmentController environmentController = Service.Get <EnvironmentController>(); serializer.AddString("clientVersion", "4.7.0.2"); serializer.AddString("model", environmentController.GetModel()); serializer.AddString("os", environmentController.GetOS()); serializer.AddString("osVersion", environmentController.GetOSVersion()); serializer.AddString("platform", environmentController.GetPlatform()); serializer.AddString("sessionId", Service.Get <ServerAPI>().SessionId); serializer.AddString("deviceId", environmentController.GetDeviceIDForEvent2()); serializer.AddString("deviceIdType", environmentController.GetDeviceIdType()); return(serializer.End().ToString()); }
private void OnGetInventorySuccess(GetUserInventoryResult result) { //Debug //Debug.Log("PlayFab - GetInventorySuccess"); DebugText.text += "\nPlayFab - GetInventorySuccess"; //Set Virtual currecy & Items owned CharacterReferences.instance.playerInfo.SetCurrency(result.VirtualCurrency["CO"], result.VirtualCurrency["GE"]); CharacterReferences.instance.charactersInfo.CheckCharacters(result.Inventory); EnvironmentController ec = EnvironmentController.instance; ec.setsList = new List <EnvironmentSet>(); EnvironmentPrefabController temp = ec.prefabsInstantiated[0]; ec.prefabsInstantiated = new List <EnvironmentPrefabController>(); Destroy(temp.gameObject); ec.GetEnvironments(); ec.SetEnvironment(); ParallaxMainController.instance.SetParallaxNewElements(); //Debug.Log("PlayFabLogin GET INVENTORY"); MMA.UpdateTexts(true); MMA.ToogleShopWindow(); ShopController.instance.InstantiateNewCharacter(); MMA.ToogleShopWindow(); isPlayFabLogged = true; }
// Start is called before the first frame update void Start() { worldState = new WorldState(PlayerInRange.no, HasObstacle.no, AtObstacle.no, PlayerDead.no); // Initial state environmentController = FindObjectOfType <EnvironmentController>(); player = FindObjectOfType <Player>(); initializeHTN(); }
public EnvironmentData(EnvironmentController env) { //Time timeMultiplier = env.timeMultiplier; daysInMonth = env.daysInMonth; MonthsInYear = env.monthsInYear; clockWork = env.Clockwork; //Temp tempMultiplier = env.tempMultiplier; tempFahrenheit = env.bIsTempFahrenheit; temperature = env.temperature; tempPrecision = env.tempPrecision; //Wind windStrengthMultiplier = env.windStrengthMultiplier; windStrength = env.windStrength; windStrengthPrecision = env.windStrengthPrecision; windAngle = env.windAngle; windAnglePrecision = env.windAnglePrecision; season = env.seasonEnum.ToString(); weather = env.weatherEnum.ToString(); }
private void TourSelect(ref List <Gene> genes, EnvironmentController environmentController, int Tour) { Assert.IsTrue(2 <= Tour && Tour <= genes.Count, "Tour is out of range. Please use Tour in range of (2, N - 1]"); List <Gene> ans = new List <Gene>(); for (int i = 0; i < selectedSize; ++i) { List <int> currTourIndices = new List <int>(); while (currTourIndices.Count < Tour) { int index = Random.Range(0, genes.Count - 1); while (currTourIndices.Contains(index)) { index = Random.Range(0, genes.Count - 1); } currTourIndices.Add(index); } List <Gene> currTour = new List <Gene>(); foreach (var index in currTourIndices) { currTour.Add(genes[index]); } Assert.IsTrue(currTour.Count >= Tour, "Tour Selection: Cannot select from a smaller population"); Select(ref currTour, environmentController, size: Tour); ans.Add(currTour[0]); } genes = ans; }
void Start() { environmentController = FindObjectOfType <EnvironmentController>(); rb = gameObject.GetComponent <Rigidbody>(); maxVelocity = 0.1f; newDestination(); }
public CreatureMoveState(Transform transform, Creature creature, GameObject emoteIcon, EnvironmentController environmentController) : base(nameof(CreatureMoveState)) { m_creatureTransform = transform; m_creature = creature; m_emoteIcon = emoteIcon; m_environmentController = environmentController; }
private void loadEnvironmentManager() { GameObject ec = new GameObject("Environment Manager"); environmentController = ec.AddComponent <EnvironmentController>(); environmentController.Life(this); ec.transform.SetParent(this.gameObject.transform); }
void Start() { m_gameManager = GameManager.Instance; m_gameManager.NotifyStateChange += OnStateChange; m_gameManager.NotifyPlayerSpawn += OnPlayerSpawn; m_environment = FindObjectOfType <EnvironmentController>(); }
// Update is called once per frame void Update() { transform.position += direction * Time.deltaTime * randomSpeed; if (transform.position.z > limitBound.z) { EnvironmentController.GetInstance().RemoveObject(this); } }
public void Setup() { this.logger = new Mock <ILogger>(); this.appEnvironmentService = new Mock <IAppEnvironmentService>(); this.userService = new Mock <IUserService>(); this.controller = new EnvironmentController(this.appEnvironmentService.Object, this.userService.Object, this.logger.Object); this.controller.Url = new UrlHelper(new RequestContext(MockHttpContext.Object, new RouteData()), RouteTable.Routes); }
private void OnTriggerEnter(Collider col) { _environment = GameObject.Find("environment").GetComponent <EnvironmentController>(); if (col.gameObject.name == "root") { _myCreature = col.transform.parent.gameObject.GetComponent <Creature>(); _myCreature.Kill(); } }
void Start() { lifeLeft = 2; getTreasure = false; environmentController = FindObjectOfType <EnvironmentController>(); toggled = false; shieldValue = 10; shieldText.text = "Shield Value: " + shieldValue; }
public void GivenAnEnvirnomentController_WhenICallItsIndexMethod_AndInTheProdEnvironment_ThenIGetTheProdPartialView() { _configurationManager.Setup(c => c.AppSetting(It.IsAny <string>())).Returns("PROD"); var controller = new EnvironmentController(_configurationManager.Object, _logger.Object); var result = (PartialViewResult)controller.Index(); result.ViewName.Should().Be("_prod"); }
public EnvironmentControllerTest() { var configuration = new MapperConfiguration(x => x.AddProfile(new AutoMapperProfile())); _mapper = new Mapper(configuration); _serviceMock = new Mock <IEnvironmentService>(); _controller = new EnvironmentController(_serviceMock.Object, _mapper); }
private void InitializeControllers() { _benchmarksController = new BenchmarksController(this, _view.BenchmarksView); _parametersController = new ParametersController(this, _view.ParametersView); _executionController = new ExecutionController(this, _view.ExecutionView); _resultsController = new ResultsController(this, _view.ResultsView); _environmentController = new EnvironmentController(this, _view.EnvironmentView); _asyncWaitController = new AsyncWaitController(this); _errorHandlingController = new ErrorHandlingController(this); }
void Start() { gameController = GameObject.FindWithTag("GameController"); ec = gameController.gameObject.GetComponent <EnvironmentController>(); player = GameObject.FindWithTag("Player"); ps = player.GetComponent <PlayerStats>(); poolStart = ec.screenSize.x + 5f; poolEnd = -5f; dealtPoints = false; }
// Start is called before the first frame update void Start() { localLocks = new List <NoteLock>(); localBlocks = new List <NoteBlock>(); localSpinners = new List <NoteSpinner>(); invis = new Color(1, 1, 1, 0); vis = new Color(1, 1, 1, 1); sr = GetComponent <SpriteRenderer>(); ec = FindObjectOfType <EnvironmentController>(); player = GameObject.Find("Player"); //ONLY WORKS IF THE PLAYER IS NAMED PLAYER. May wish to find a better way of getting a reference to the player }
IEnumerator Attacks() { EnvironmentController ec = EnvironmentController.instance; while (isOnSight && ec.inGame) { isAttacking = true; if (!flamethrower) { AC.AttackAnim(false); } if (isMelee) { VFXAA.VFXInstantiate(meleeAttackDelay); SC.PlaySound(); yield return(new WaitForSeconds(AC.attackAnimDuration)); } if (!isMelee) { if (flamethrower) { if (!firstflame) { firstflame = true; AC.AttackAnim(false); VFXAA.VFXPersistent(true); SC.PlaySound(0, 0.3f); } yield return(new WaitForSeconds(AC.attackAnimDuration)); } else { yield return(new WaitForSeconds(AC.rangedAttackDelay)); GameObject bullet = Instantiate(bulletPrefab); VFXAA.VFXInstantiate(); SC.PlaySound(); bullet.transform.position = bulletSpawn.position; bullet.GetComponent <BulletController>().damage = damage; yield return(new WaitForSeconds(AC.attackAnimDuration - AC.rangedAttackDelay)); } } AC.IdleAnim(); if (!flamethrower) { isAttacking = false; } yield return(new WaitForSeconds(secondsToAttackAgain)); } if (isOnSight == false) { AC.IdleAnim(); } }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
public void Awake() { // SET UP INITIAL SIZE OF BALL transform.localScale = Vector3.one * Scale; radius = GetComponent <SpriteRenderer>().bounds.size.x / 2; rigid = GetComponent <Rigidbody2D>(); environment = Transform.FindObjectOfType <EnvironmentController>(); uIManager = Transform.FindObjectOfType <UIManager>(); }
public void Activate() { var contract = "a"; var specification = new MockEnvironmentSpecification( new EnvironmentId("e"), "a", "b", "c", true, true, "d", "e", new OperatingSystemSpecification("f", "g", CultureInfo.InvariantCulture, 64), new List<ApplicationSpecification>()); var activeEnvironment = new Mock<IActiveEnvironment>(); var sectionBuilder = new Mock<ITestSectionBuilder>(); var activator = new Mock<IEnvironmentActivator>(); { activator.Setup(a => a.EnvironmentContractToLoad) .Returns(contract); activator.Setup( a => a.Load( It.IsAny<MachineEnvironmentSpecification>(), It.IsAny<ITestSectionBuilder>(), It.IsAny<Action<EnvironmentId>>())) .Callback<MachineEnvironmentSpecification, ITestSectionBuilder, Action<EnvironmentId>>( (e, t, a) => { Assert.AreSame(specification, e); Assert.IsNotNull(t); Assert.IsNotNull(a); }) .Returns(activeEnvironment.Object); } var controller = new EnvironmentController( new List<MachineEnvironmentSpecification> { specification, }, new List<IEnvironmentActivator> { activator.Object, }); var environment = controller.Activate(specification.Id, sectionBuilder.Object); Assert.AreSame(activeEnvironment.Object, environment); Assert.AreEqual(0, controller.CurrentlyInActive().Count()); Assert.AreEqual(1, controller.CurrentlyActive().Count()); Assert.AreSame(specification.Id, controller.CurrentlyActive().First()); }
public void ActivateWithMissingActivator() { var specification = new MockEnvironmentSpecification( new EnvironmentId("e"), "a", "b", "c", true, true, "d", "e", new OperatingSystemSpecification("f", "g", CultureInfo.InvariantCulture, 64), new List<ApplicationSpecification>()); var sectionBuilder = new Mock<ITestSectionBuilder>(); var controller = new EnvironmentController( new List<MachineEnvironmentSpecification> { specification, }, new List<IEnvironmentActivator>()); Assert.Throws<ArgumentException>(() => controller.Activate(specification.Id, sectionBuilder.Object)); }