- Home /
Question by
knarken · Nov 20, 2014 at 07:39 PM ·
c#booleanif-statements
Boolean issues
Hi, I currently have the problem that I'm able to activate the "yellow color" and change to "pink" but not the other way around so hopefully someone here is able to point me in the right direction :)
using UnityEngine;
using System.Collections;
public class ColorControllerScript : MonoBehaviour {
public GameObject LightPinkBox;
public GameObject LightYellowBox;
public GameObject LightBullet1;
public vp_HitscanBullet script;
public Texture splat1;
public Texture splat2;
public Texture splat3;
// Use this for initialization
void Start () {
LightBullet1.renderer.sharedMaterial.mainTexture = splat1;
LightBullet1.renderer.sharedMaterial.color = Color.green;
script = LightBullet1.GetComponent<vp_HitscanBullet>();
}
// Update is called once per frame
void FixedUpdate () {
ChangeColor();
}
void ChangeColor()
{
if(LightYellowScript.FromGreenToYellow==true)
{
print("Can change to yellow");
LightBullet1.renderer.sharedMaterial.color = Color.yellow;
LightBullet1.renderer.sharedMaterial.mainTexture = splat3;
}
if(LightPinkScript.FromGreenToPink==true)
{
print("Can change to pink");
LightBullet1.renderer.sharedMaterial.color = Color.red;
LightBullet1.renderer.sharedMaterial.mainTexture = splat2;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Integer gets too many additions 2 Answers
How Do I check if a Bool was True a few moments ago 2 Answers
Scavenger Hunt List Bools Question 1 Answer