void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Wall") { if (other.contacts[0].normal == -(Vector2)GetDirectionAsVector()) { Messenger <float> .Broadcast("screenshake", speed / 50); audioController.Crash(speed); playerGraphics.StillSprite(); StartCoroutine("BlockControls"); SlowDown(); Debug.Log("Crash"); } else { Messenger <float> .Broadcast("screenshake", speed / 100); speed -= speedDecreaseBump; ColorController.UpdateSpeed(GetSpeedPercentage()); playerTail.Clear(); Debug.Log("Close call"); } } }
void SlowDown() { Debug.Log("PlayerSpeed was: " + speed); playerTail.Clear(); speed_TEST = startingSpeed; speed = startingSpeed; // speed = Mathf.Clamp(speed - speedIncrease, startingSpeed, maxSpeed); // ColorController.ResetDuration(); // ColorController.ResetSpeed(); ColorController.UpdateSpeed(GetSpeedPercentage()); if (tR != null) { tR.Clear(); } crashDirection = direction; direction = directions.None; ColorController.SkipForward(); timerScript.PauseTimer(); // Debug.Log("S"); }
private void internalUnregisterColorController(ColorController colorController) { if (colorControllers[(int)colorController.colorType].Contains(colorController)) { colorControllers[(int)colorController.colorType].Remove(colorController); } }
private void InitializeColors() { colorController = new ColorController(); colorController.Initialize(); ChangeColors(); //call initially and then after level up ArrowColor(); }
private void Start() { _sprite = GetComponent <SpriteRenderer>(); _controller = GameObject.FindObjectOfType <ColorController>(); Update(); }
void Start() { red = GameObject.FindWithTag("RedController").GetComponent <ColorController>(); blue = GameObject.FindWithTag("BlueController").GetComponent <ColorController>(); red.ColorChange += setRed; blue.ColorChange += setBlue; }
private void internalRegisterColorController(ColorController colorController) { if (!colorControllers[(int)colorController.colorType].Contains(colorController)) { colorControllers[(int)colorController.colorType].Add(colorController); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ColorController cc = new ColorController(); Uri myUri = new Uri(Request.Url.ToString()); string ColorId = HttpUtility.ParseQueryString(myUri.Query).Get("ID"); if (ColorId == null) { Response.Redirect("ListColors.aspx"); } cc.GetColor(int.Parse(ColorId)); Color.Text = cc.Color; if (cc.IsPublished == false) { IsPublished.Checked = false; } else { IsPublished.Checked = true; } LanguageController lc = new LanguageController(); ddlLanguageId.DataSource = lc.GetLanguages(); ddlLanguageId.DataTextField = "LanguageTitle"; ddlLanguageId.DataValueField = "LanguageID"; ddlLanguageId.DataBind(); ddlLanguageId.SelectedValue = cc.LanguageID.ToString(); } }
public void UpdateColor() { colorScript = GameObject.FindGameObjectWithTag("ColorController").GetComponent <ColorController>(); if (colorScript == null) { return; } mat = GetComponent <Renderer>().sharedMaterial; if (mat == null) { return; } SetNewColors(colorScript.PrimaryColor, colorScript.SecondaryColor, colorScript.ThirdColor); if (alpha != 1.0f) { Color primary = new Color(colorScript.PrimaryColor.r, colorScript.PrimaryColor.g, colorScript.PrimaryColor.b, alpha); Color secondary = new Color(colorScript.SecondaryColor.r, colorScript.SecondaryColor.g, colorScript.SecondaryColor.b, alpha); Color third = new Color(colorScript.ThirdColor.r, colorScript.ThirdColor.g, colorScript.ThirdColor.b, alpha); SetNewColors(primary, secondary, third); } }
// Use this for initialization void Start() { game = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); playerColliders = GetComponentsInChildren <BoxCollider>(); isFall = false; allowForward = allowBack = allowLeft = allowRight = true; restrictAllInput = false; moveCount = 0; game.UpdateMoveCountText(); playerBody = transform.GetChild(0); rbody = GetComponent <Rigidbody>(); cam = transform.parent.GetChild(1).gameObject; cameraScript = cam.gameObject.GetComponent <CameraScript>(); mainCameraTransform = cam.transform.GetChild(0); mainCamera = mainCameraTransform.GetComponent <Camera>(); directionScript = cam.GetComponent <DetermineDirectionScript>(); playerRenderer = GetComponentInChildren <MeshRenderer>(); playerColorCon = GetComponentInChildren <ColorController>(); isKeyboard = PlayerPrefs.GetInt("isKeyboard") == 1; }
private void OnCollisionEnter2D(Collision2D collision) { if (isFound || doorController == null) { return; } if (collision.gameObject.tag == "Player") { ColorController colorControllerTemp = collision.gameObject.GetComponent <ColorController>(); if (colorControllerTemp.CountListColor() > 0 && colorControllerTemp.listColor[0] == colorController.listColor[0]) { colorControllerTemp.ShowNextColor(); } else { colorControllerTemp.listColor = colorController.listColor; colorControllerTemp.SetColorLevel(colorController.getCurrentColorLevel()); colorControllerTemp.UpdateSpriteColor(); } SetIsFound(true); MaxColorLevel(); doorController.AskOpen(); audioController.PlayAudio(soundInteract); } }
private void Awake() { if (_instance == null) { _instance = this; } }
void Start() { objectManager = GameObject.FindGameObjectWithTag("GameManager"); gameManager = objectManager.GetComponent <GameManager>(); gameManager.InitialisationPlayer(); endLevel = false; isDead = false; shopDisabled = false; lifeController = gameObject.GetComponent <LifeController>(); healthText = GameObject.Find("HealthText").GetComponent <Text>(); healthText.text = ": " + lifeController.GetLife() + " / " + lifeController.GetLifeMax(); goldController = gameObject.GetComponent <GoldController>(); CoinText = GameObject.Find("CoinText").GetComponent <Text>(); CoinText.text = ": " + goldController.GetEnergy() + " / " + goldController.GetEnergyMax(); // player's color is define in the inspector colorController = gameObject.GetComponent <ColorController>(); if (colorController.GetColor() == 1) { this.GetComponent <SpriteRenderer>().color = new Color(0.4f, 0.4f, 1f, 1f); } else { this.GetComponent <SpriteRenderer>().color = new Color(1f, 0.4f, 0.4f, 1f); } }
// Use this for initialization void Start() { abilities = Abilities.instance; c = ColorController.instance; OnClick += ResetColors; ColorController.OnColorSet += SetColor; }
protected void Insert_Click(object sender, EventArgs e) { ColorController cc = new ColorController(); cc.Insert(Color.Text, IsPublished.Checked, int.Parse(ddlLanguageId.SelectedValue)); Response.Redirect("ListColors.aspx"); }
void Start() { if (targets.Length == 0) { targets = new GameObject[1]; targets[0] = gameObject; } discoverer = GameObject.FindWithTag("Player"); green = GameObject.FindWithTag("GreenController").GetComponent <ColorController> (); green.ColorChange += setTransparence; transparence = 0f; foreach (GameObject obj in targets) { SpriteRenderer r = obj.GetComponent <SpriteRenderer>(); renderers.Add(r); if (reveal) { r.material.SetColor("_Color", new Color(1, 1, 1, 0)); } else { r.material.SetColor("_Color", new Color(1, 1, 1, 1)); } } }
public async Task SetColor_ForMultiPortDevice_TurnOn_Port1_SendsTurnOnPort1() { // Arrange string messageId = "Message12"; var device = new DeviceDto { Id = "Endpoint1" }; var deviceAndPort = new DeviceAndPort(device, 1); var request = BuildRequest(messageId, "SetColor", deviceAndPort.ToString()); List <DeviceDto> devices = new List <DeviceDto> { new DeviceDto { DisplayName = "Device 1" } }; var devicesClient = new FakeDevicesClient(devices); var measurementsClient = new FakeMeasurementsClient(); var statusClient = new FakeStatusClient(); var controller = new ColorController(devicesClient, measurementsClient, statusClient); // Act ColorControlResponse response = (ColorControlResponse)await controller.HandleAlexaRequest(request, null); // Assert Assert.IsNotNull(response); Assert.AreEqual("@Switch Set color HSV 23.5,0.3,0.2 port-1", statusClient.SentMessage); }
void OnDisable() { if (instance != null) { instance = null; } }
// Изменение цвета Player при контакте с красителем private void ChangeMyColor(ColorController colorObj) { if (colorObj.MyColor != MyColor) { soundCon.PlaySound("change"); MyColor = colorObj.MyColor; if (MyColor == AllColor.green) { spriteRen.sprite = mySprites[0]; } else if (MyColor == AllColor.yellow) { spriteRen.sprite = mySprites[1]; } else if (MyColor == AllColor.blue) { spriteRen.sprite = mySprites[2]; } else if (MyColor == AllColor.red) { spriteRen.sprite = mySprites[3]; } Destroy(colorObj.gameObject, .3f); } }
// Use this for initialization void Start() { ColorController.OnColorSet += SetColor; colorController = ColorController.instance; timeManager = TimeManager.instance; currentTime = 90f; }
/// <summary> /// Author: Ben Hoffman /// Purpose of method: To check when I am colliding and /// what I am colliding with /// </summary> /// <param name="c"> What I am colliding with </param> void OnCollisionEnter(Collision c) { ColorController cColor = c.gameObject.GetComponent <ColorController>(); if (cColor != null && c.gameObject.tag == "changer" && c.gameObject.layer != gameObject.layer) { colorControls.ChangeColor(cColor.color); } // If the collision is with the death bounds, then make a short pause, and then show the menu // That gives the options to restart or go to the main menu if (c.gameObject.tag == "bounds" || c.gameObject.tag == "triangleOfDoom") { // Reset the players spot gameController.Lose(gameObject); } if (c.gameObject.tag == "winner") { // The player has won! gameController.HitWinBlock(); Destroy(c.gameObject); } if (c.gameObject.tag == "teleporter") { c.gameObject.GetComponent <Teleporter>().Teleport(gameObject); } }
void Start() { speedUp = false; points = 0; myRigidbody = this.GetComponent <Rigidbody>(); m_Material = GetComponent <Renderer>().material; m_Material.color = Color.blue; colorController = GameObject.FindGameObjectWithTag("Player").GetComponent <ColorController>(); lastX_force = 5f; lastY_force = 0f; lastDist = 0f; lastV = 0f; int rand = Random.Range(0, 2); if (rand == 0) { myRigidbody.velocity = new Vector3(-lastX_force, 0f); } else if (rand == 1) { myRigidbody.velocity = new Vector3(lastX_force, 0f); } modifier = 1.5f; disModifier = 1.5f; }
public static void UnregisterColorController(ColorController colorController) { if (instance) { instance.internalUnregisterColorController(colorController); } }
void Start() { groundedSpeedController = GameObject.FindWithTag("YellowController").GetComponent <ColorController> (); airSpeedController = GameObject.FindWithTag("BlueController").GetComponent <ColorController> (); groundedSpeedController.ColorChange += setGroundedSpeedBonus; airSpeedController.ColorChange += setAirSpeedBonus; rb = gameObject.GetComponent <Rigidbody2D>(); }
[ClientRpc] // This function will only be used bt the server, to broadcast everyone color void RpcChangeColor() { colorController = GameObject.FindGameObjectWithTag("Mananger").GetComponent <ColorController> (); playerColorIndex = colorController.GetColorIndex(playerColorIndex); colorController.status[playerColorIndex] = true; GetComponent <MeshRenderer> ().material.color = colorController.colors [playerColorIndex]; hasColor = true; }
// Use this for initialization void Start() { colorCon = GetComponentInChildren <ColorController>(); if (launchTube != null) { tube = launchTube.GetComponent <TubeScript>(); } }
protected virtual void Start() { _health = _maxHealth; _rb = GetComponent <Rigidbody2D>(); _colourController = GameObject.FindObjectOfType <ColorController>(); _colourSprite = GetComponent <ColorSprite>(); }
private void onColorChange(ColorType newCol) { lt = GetComponent <Light>(); // tu mets ici le code pour quand la couleur change Color inter = ColorController.getColorFromType(newCol); lt.color = inter; }
public void LapComplete() { // Debug.Break(); speed += speedIncreaseLap; ColorController.UpdateSpeed(GetSpeedPercentage()); // ColorController.IncreasedSpeed(0.2f); // ColorController.SkipForward(); }
protected override void Awake() { base.Awake(); ColorChanger = GetComponent <ColorController>(); base.clickHandler = this; base.hitHandler = this; transform.Rotate(0, 180, 0); }
// Use this for initialization void Start() { transform.position = startWaypoint.transform.position; setCurrentWaypoint(startWaypoint); mat = GetComponent<Renderer>().material; controller = GameObject.FindObjectOfType<ColorController>(); updateStatesBasedOnColor(); }
// Use this for initialization void Start() { //Used for scaling shrinkValue smallestScale = System.Math.Min(System.Math.Min(transform.lossyScale.x,transform.lossyScale.y),transform.lossyScale.z); Current = new EmittingObject (); colorController = GameControl.instance.GetComponent<ColorController> (); player = GameControl.instance.player.transform; coll = gameObject.GetComponent<BoxCollider> (); //create child gameObject to attach the shrinked collider to colorCenter = new GameObject("center"); colorCenter.transform.SetParent(gameObject.transform, false); colorCenter.layer = LayerMask.NameToLayer ("Ethereal"); //Create and attach the shrinked collider createShrinkedCollider (coll); //Resize the shrinked collider from shrinkValue calculateShrinkedBounds (coll); }
void Awake() { colorController = GetComponent<ColorController>(); }