//Slowly Mixes the two limes colors public void MixColors(ColourController otherSlime) { //Storing Colors //Stores the players color float tempRed = redValue; float tempBlue = blueValue; float tempGreen = greenValue; //Stores the other slimes color float tempSlimeRed = otherSlime.redValue; float tempSlimeGreen = otherSlime.greenValue; float tempSlimeBlue = otherSlime.blueValue; //Mixing Colors //Mixes the Players Colors towards the other slime Mathf.Lerp(redValue, tempSlimeRed, 2.0f * Time.deltaTime); Mathf.Lerp(greenValue, tempSlimeGreen, 2.0f * Time.deltaTime); Mathf.Lerp(blueValue, tempSlimeBlue, 2.0f * Time.deltaTime); //Mixes the other Slimes Colors towards the players Mathf.Lerp(otherSlime.redValue, tempRed, 2.0f * Time.deltaTime); Mathf.Lerp(otherSlime.greenValue, tempGreen, 2.0f * Time.deltaTime); Mathf.Lerp(otherSlime.blueValue, tempBlue, 2.0f * Time.deltaTime); //Setting Colors //Make the color change SetColors(); //Sets the color on the other slime too otherSlime.SetColors(); }
//Takes the other slimes colors and leaves is white public void StealColors(ColourController otherSlime) { //Takes the other slimes color if (redValue >= 1) { redValue = 1; } else { redValue += otherSlime.redValue; } if (blueValue >= 1) { blueValue = 1; } else { blueValue += otherSlime.blueValue; } if (greenValue >= 1) { greenValue = 1; } else { greenValue += otherSlime.greenValue; } //Replaces the other slimes color otherSlime.redValue = 0.0f; otherSlime.blueValue = 0.0f; otherSlime.greenValue = 0.0f; }
void Start() { playerRigidBody = GetComponent <Rigidbody>(); colourController = GameObject.FindObjectOfType <ColourController>(); pauseController = GameObject.FindObjectOfType <PauseController>(); colourController.AssignBulletColour(shot, colourController.GetBulletColourIndex()); }
protected void AdjustDifficultyOfEnemies() { switch (waveNumber) { // Disable idle enemies and enable kamikaze on wave 2. case 2: ColourController.SetColourLimit(4); EnemyController.SetMinimumEnemyDifficultyOffset(1); EnemyController.SetMaximumEnemyDifficultyOffset(2); break; // Disable straight shooters and enable rotating shooters on wave 3. case 3: ColourController.SetColourLimit(5); EnemyController.SetMinimumEnemyDifficultyOffset(2); EnemyController.SetMaximumEnemyDifficultyOffset(1); break; // Disable straight flying kamikaze enemies and enable homing kamikaze enemies on wave 4. case 4: ColourController.SetColourLimit(6); EnemyController.SetMinimumEnemyDifficultyOffset(3); EnemyController.SetMaximumEnemyDifficultyOffset(0); break; } }
// Use this for initialization void Start() { uiManager = GameObject.FindGameObjectWithTag("UIManager").GetComponent <UIManager>(); colourController = this.gameObject.GetComponent <ColourController>(); FPSController = this.gameObject.GetComponent <FirstPersonController>(); frequency = 4; maxAmplitude = .6f; minAmplitude = .3f; maxBarSpeed = -5; minBarSpeed = 1; hugDecreaseValue = 0.02f; transferRate = 0.01f; IsHugging = false; StartedHugging = false; ColourTransfered.value = .2f; HugBar.value = 0; for (int i = 0; i < frequency; i++) { SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); } // SlimeFrequencyAndAmplitude = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1)); SlimeFrequencyAndAmplitude.preWrapMode = WrapMode.PingPong; SlimeFrequencyAndAmplitude.postWrapMode = WrapMode.PingPong; //SlimeFrequencyAndAmplitude.RemoveKey(0); //SlimeFrequencyAndAmplitude.RemoveKey(frequency); //SlimeFrequencyAndAmplitude.AddKey(.5f, -2.5f); }
void Start() { globalData = GetComponent <GlobalData>(); colourController = GetComponent <ColourController>(); colourController.SortColours(); FixText(); StartCoroutine(colourController.SceneChange("")); }
void Awake() { Instance = this; colourController = ColourController.Instance; spawnController = SpawnController.Instance; scoreController = ScoreController.Instance; playerController = PlayerController.Instance; audioController = AudioController.Instance; }
public static void Rainbowify(Saber saber, ColourController controller, float bpm) { GameObject gameObject = new GameObject("Chroma_VFXRainbowSaber"); gameObject.transform.SetParent(saber.transform, false); VFXRainbowSaberModule vfx = gameObject.AddComponent <VFXRainbowSaberModule>(); vfx.controller = controller; vfx.bpm = bpm; vfx.saberColourizer = new SaberColourizer(saber); vfx.Init(); }
public virtual void Init() { colourController = ColourController.Instance; sprite = GetComponent <SpriteRenderer>(); if (sprite.color != colourController.GetColour(colour)) { sprite.color = colourController.GetColour(colour); } col = GetComponent <Collider2D>(); }
public void Init() { rBody = GetComponent <Rigidbody2D>(); colourController = ColourController.Instance; switchableController = SwitchableController.Instance; sprite = GetComponentInChildren <SpriteRenderer>(); sprite.color = colourController.GetColour(colourController.CurrentColour); trail = GetComponent <TrailRenderer>(); trail.startColor = sprite.color; trail.endColor = sprite.color; }
// Use this for initialization void Start() { slimeColour = gameObject.GetComponent <ColourController>(); float average = (slimeColour.blueValue + slimeColour.redValue + slimeColour.greenValue) / 3; chaseSpeed = average; wayPointIndex = Random.Range(0, 3); idleWayPoints[0] = (Transform)Instantiate(wayPoint, new Vector3(transform.position.x + Random.Range(8, 10), transform.position.y, transform.position.z), Quaternion.identity); idleWayPoints[1] = (Transform)Instantiate(wayPoint, new Vector3(transform.position.x - 10, transform.position.y, transform.position.z + 10), Quaternion.identity); idleWayPoints[2] = (Transform)Instantiate(wayPoint, new Vector3(transform.position.x - 10, transform.position.y, transform.position.z - 10), Quaternion.identity); }
private void Awake() { Instance = this; colourController = ColourController.Instance; if (PlayerPrefs.HasKey("HighScore")) { highscoreText.text = "HighScore: " + PlayerPrefs.GetInt("HighScore").ToString(); } else { highscoreText.text = "HighScore: 0"; } }
void Start() { colourController = GameObject.FindObjectOfType <ColourController> (); mainController = GameObject.FindObjectOfType <MainController> (); levelController = GameObject.FindObjectOfType <LevelController> (); colourController.AssignRandomColour(gameObject); randomBehaviourNumber = Random.Range(MinimumEnemyDifficultyOffset, NumBehaviours - MaximumEnemyDifficultyOffset); // Attaches the SelfDeletionTimer script to any kamikaze enemies that spawn. if (randomBehaviourNumber == (int)Behaviours.Kamikaze || randomBehaviourNumber == (int)Behaviours.HomingKamikaze) { gameObject.AddComponent(SelfDeletionScriptType); } }
void Start() { staffBuilder = GetComponent <StaffBuilder>(); barBuilder = GetComponent <BarBuilder>(); colourController = GetComponent <ColourController>(); foreach (Material mat in itemMaterials) { mat.color = colourController.getItem(); } globalData = GetComponent <GlobalData>(); colourController.SortColours(); UICamera.backgroundColor = mainCamera.backgroundColor; staffBuilder.GenerateStaff(); cameraFlash = flashCamera.GetComponent <CameraFlash>(); flashController = GetComponent <FlashController>(); }
//Combines the two slimes colour and shares it between them public void CombineColors(ColourController otherSlime) { //Adds up the slime colours float mixRed = (redValue + otherSlime.redValue) / 2.0f; float mixGreen = (greenValue + otherSlime.greenValue) / 2.0f; float mixBlue = (blueValue + otherSlime.blueValue) / 2.0f; //Changes the other slimes colour to the averge otherSlime.redValue = mixRed; otherSlime.greenValue = mixGreen; otherSlime.blueValue = mixBlue; //Stores the players color redValue = mixRed; blueValue = mixBlue; greenValue = mixGreen; }
public override void OnInspectorGUI() { DrawDefaultInspector(); ColourController myScript = (ColourController)target; selected[0] = EditorGUILayout.Popup("Front", selected[0], options); selected[1] = EditorGUILayout.Popup("Back", selected[1], options); selected[2] = EditorGUILayout.Popup("Right", selected[2], options); selected[3] = EditorGUILayout.Popup("Left", selected[3], options); selected[4] = EditorGUILayout.Popup("Top", selected[4], options); if (GUILayout.Button("Save Changes")) { myScript.ApplyMaterials(selected); } }
public void GetAllReturnsAListOfUsers() { var mockService = new Mock <IColourService>(); mockService.Setup(s => s.GetAll()).Returns(new List <ColourDto> { new ColourDto(1, "Red"), new ColourDto(2, "Blue"), new ColourDto(3, "Green"), }); var controller = new ColourController(mockService.Object); var actual = controller.GetAll().ToList(); actual.Count().ShouldBe(3); actual.First().Id.ShouldBe(1); actual.First().Name.ShouldBe("Red"); }
//Swap Colors public void SwapColors(ColourController otherSlime) { //Stores the players color float tempRed = redValue; float tempBlue = blueValue; float tempGreen = greenValue; //Takes the other slimes color redValue = otherSlime.redValue; blueValue = otherSlime.blueValue; greenValue = otherSlime.greenValue; //Replaces the other slimes color otherSlime.redValue = tempRed; otherSlime.blueValue = tempBlue; otherSlime.greenValue = tempGreen; //Make the color change SetColors(); }
public void CreateCellTile(int gridSize) { float res = (float)(Screen.height) / Screen.width; float dist = (float)Screen.height / gridSize; float posX = (cellPos.x - (float)(gridSize) / 2 + 0.5f) * 0.6f * res * (20.0f / gridSize); float posY = (cellPos.y - (float)(gridSize) / 2 + 0.5f) * 0.6f * res * (20.0f / (float)gridSize); cellTile = new GameObject("tile" + cellPos.x.ToString() + "_" + cellPos.y.ToString()); cellTile.transform.localScale = new Vector2(3.2f * (20.0f / gridSize), 3.2f * (20.0f / gridSize)); sr = cellTile.AddComponent <SpriteRenderer>(); //add a sprite renderer sr.size = new Vector2(10, 10); sr.sprite = this.cellSprite; //tileSprite;//assign tile sprite cellTile.transform.position = new Vector2(posX, posY); colourController = cellTile.AddComponent <ColourController>(); cellTile.AddComponent <TriggerTest>(); BoxCollider2D boxCollider = cellTile.AddComponent <BoxCollider2D>(); boxCollider.isTrigger = true; if (cellType != CellType.Black && cellType != CellType.White) { colourController.Hide(); } }
public void Init() { colourController = ColourController.instance; colourOneSwitchables = new List <SwitchableObject>(); colourTwoSwitchables = new List <SwitchableObject>(); foreach (GameObject switchable in GameObject.FindGameObjectsWithTag("Switchable")) { SwitchableObject s = switchable.GetComponent <SwitchableObject>(); s.Init(); if (s.colour == SwitchableColour.colourOne) { colourOneSwitchables.Add(s); } else { colourTwoSwitchables.Add(s); } } Switch(); }
//Opens the gate if the player is the correct Color void OnTriggerEnter(Collider coll) { print("GateController Hit"); //Checks that it is the player interacting with the door if (coll.gameObject.tag == "Player") { print("GateController Color Check"); //Checks wether or not the player has the necicary colors to open tyhe door colorController = coll.gameObject.GetComponent <ColourController>(); if (colorController.redValue >= redReq && colorController.blueValue >= blueReq && colorController.greenValue >= greenReq) { print("Door is open"); isOpen = true; colorController.CleanSlime(); } } //Opens the door if (isOpen == true) { door.gameObject.SetActive(false); } }
void Start() { colourController = GameObject.FindGameObjectWithTag("GameController").GetComponent <ColourController>(); gameObject.GetComponent <Camera>().backgroundColor = colourController.getBG(); }
private void Start() { controller = this.GetComponent <ColourController>(); controller.UpdateColour(sourceColour); }
private void Start() { controller = this.GetComponent <ColourController>(); triggered = false; audioCon = FindObjectOfType <AudioController>(); }
// Update is called once per frame void Update() { RaycastHit hit; Vector3 fwd = transform.TransformDirection(Vector3.forward); if (timer > timelimit) { if (Physics.Raycast(transform.position, fwd, out hit, 1)) { print("hit"); //Debug.DrawRay (transform.position, fwd * 100,Color.red); if (hit.transform.tag == "Slime") { if (gettingHugged) { } Debug.Log(hit.transform.name); ColourController colour = hit.transform.gameObject.GetComponent <ColourController> (); //COMMENTS MOFOS!!!!!!! // if (colour.greenValue >= colour.defualtGreen - .10f && colour.redValue >= colour.defualtRed - .10f && colour.blueValue >= colour.defualtBlue - .10f) //{ Debug.Log("Check"); TargetSlime = hit.transform.gameObject.GetComponent <ColourController> (); uiManager.ToggleHuggingGUI(true); if (FPSController.enabled == true) { FPSController.enabled = false; } IsHugging = true; } //} } timer = 0.0f; } else { timer += Time.deltaTime; } hugMaxValue = HugBar.value + 0.1f; hugMinValue = hugMaxValue - 0.2f; if (IsHugging == true) { Debug.Log("1"); if (!hasCreatedHug) { for (int i = 0; i < frequency; i++) { SlimeFrequencyAndAmplitude.RemoveKey(0); } if (uiManager.currentSelectedHug == "Happy") { frequency = 2; maxAmplitude = 0.3f; minAmplitude = 0f; maxBarSpeed = (-2); minBarSpeed = 1; for (int i = 0; i < frequency; i++) { SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); } } else if (uiManager.currentSelectedHug == "Theif") { frequency = 4; maxAmplitude = 0.6f; minAmplitude = 0f; maxBarSpeed = (-5); minBarSpeed = 1; for (int i = 0; i < frequency; i++) { SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); } } else if (uiManager.currentSelectedHug == "Bear") { frequency = 8; maxAmplitude = 1f; minAmplitude = 0f; maxBarSpeed = 0; minBarSpeed = 5; for (int i = 0; i < frequency; i++) { SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); } } else if (uiManager.currentSelectedHug == "Unknown") { frequency = 100; maxAmplitude = 1f; minAmplitude = 0f; maxBarSpeed = 30; minBarSpeed = 10; for (int i = 0; i < frequency; i++) { SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); } hasCreatedHug = true; } } if (Input.GetKey(KeyCode.Space)) { StartedHugging = true; HugBar.value += hugDecreaseValue; } if (StartedHugging == true) { HugBar.value -= hugDecreaseValue / 4; SlimeBar.value = SlimeFrequencyAndAmplitude.Evaluate(Time.time); if (SlimeBar.value <= hugMaxValue && SlimeBar.value >= hugMinValue) { ColourTransfered.value += transferRate; } else { ColourTransfered.value -= transferRate / 4; } if (ColourTransfered.value <= 0) { // for (int i = 0; i < frequency; i++) // { // SlimeFrequencyAndAmplitude.RemoveKey(0); // } // // for (int i = 0; i < frequency; i++) // { // SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); // } if (FPSController.enabled == false) { FPSController.enabled = true; } StartedHugging = false; IsHugging = false; uiManager.ToggleHuggingGUI(false); HugBar.value = 0; SlimeBar.value = 0; ColourTransfered.value = .2f; hasCreatedHug = false; } if (ColourTransfered.value >= 1) { if (uiManager.currentSelectedHug == "Happy") { colourController.StealColors(TargetSlime); } if (uiManager.currentSelectedHug == "Theif") { colourController.CleanSlime(); } if (uiManager.currentSelectedHug == "Bear") { colourController.SwapColors(TargetSlime); } if (uiManager.currentSelectedHug == "Unknown") { colourController.SwapColors(TargetSlime); } if (gettingHugged) { AISlime = currentSlime.GetComponent <aiSlime> (); // AISlime.OutCome (true); } // for (int i = 0; i < frequency; i++) // { // SlimeFrequencyAndAmplitude.RemoveKey(0); // } // // for (int i = 0; i < frequency; i++) // { // SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); // } if (FPSController.enabled == false) { FPSController.enabled = true; } StartedHugging = false; IsHugging = false; uiManager.ToggleHuggingGUI(false); HugBar.value = 0; SlimeBar.value = 0; ColourTransfered.value = .2f; hasCreatedHug = false; } } if (Input.GetKeyDown(KeyCode.S)) { // for (int i = 0; i < frequency; i++) // { // SlimeFrequencyAndAmplitude.RemoveKey(0); // } // // for (int i = 0; i < frequency; i++) // { // SlimeFrequencyAndAmplitude.AddKey((Random.Range(minBarSpeed, maxBarSpeed)), (Random.Range(minAmplitude, maxAmplitude))); // } if (FPSController.enabled == false) { FPSController.enabled = true; } StartedHugging = false; IsHugging = false; uiManager.ToggleHuggingGUI(false); HugBar.value = 0; SlimeBar.value = 0; ColourTransfered.value = .2f; hasCreatedHug = false; } } }