//show damage at a point and make it a certain color public void ShowDamage(int _damage, Vector2 _pos, ColorElement _color) { //make new display object GameObject _display = (GameObject)GameObject.Instantiate(_emptyNums, _pos, Quaternion.identity); //length of the string representation of the value int _length = ((int)_damage).ToString().Length; //start to the left of the center for odd digit numbers float _startX = 0f - _length / 2 * _spacing; //if one digit set at origin if (_length == 1) { _startX = 0; } //if even digit number adjust spacing else if ((_length & 1) == 0) { _startX += _spacing / 2; } //create number for (int i = 0; i < _length; i++) { //find digit GameObject num = (GameObject)Resources.Load(_numPath + _damage.ToString().Substring(i, 1)); GameObject newNum = (GameObject)GameObject.Instantiate(num); //set within empty num newNum.transform.parent = _display.transform; //arrange position based on digit newNum.transform.localPosition = new Vector2(_startX + i * _spacing, 0); newNum.GetComponent <Renderer>().material.color = CustomColor.GetColor(_color); } }
private static void Block() { if (!doOnce) { doOnce = true; blocking = true; block.GetComponent <Renderer>().material.color = CustomColor.GetColor(FindObjectOfType <PlayerColorData>().Color); block.Show(); } }
void Start() { //find wheel _wheel = GameObject.Find("ColorWheel").GetComponent <ColorWheel>(); //init scale at 0 this.transform.localScale = new Vector3(0.5f, 1f, 1f); //set color this.GetComponent <Image>().color = CustomColor.GetColor(_color); }
//something enters collector trigger void OnTriggerEnter2D(Collider2D col) { //if it is an orb if (col.transform.tag.Equals("orb")) { //get the color and destroy the orb ----- ADD COLLECTING EFFECT LATER ColorPickup _orb = col.transform.GetComponent <ColorPickup>(); _player.AddColor(CustomColor.GetColor(_orb.ColorType), _orb.Amount); _orb.GetComponent <Destroyer>().DestroyImmediate(); } }
//Initialize the enemy public void Init() { //set the enemy color renderer.material.color = CustomColor.GetColor(_color); //load the orb _orb = (GameObject)Resources.Load("Prefabs/orb"); //find the player _player = GameObject.Find("player"); }
void Awake() { //set color this.GetComponent <Image>().color = CustomColor.GetColor(_color); //assign name and color of text _name = this.transform.FindChild(this.transform.name + " Text").GetComponent <Text>(); _name.text = this.transform.name; _name.color = CustomColor.GetColor(_color); _greyTab = this.transform.FindChild(this.transform.name + " Cover").gameObject; }
void Update() { if (!Data.GameManager.SuspendedState) { //meters are full so we can flash if (_r.transform.localScale.x == 1 && _g.transform.localScale.x == 1 && _b.transform.localScale.x == 1) { Full = true; } else if (!_achromic) { Full = false; } //if we can flash if (_full && !_achromic) { //going to black if (_increase) { _timer += Time.deltaTime; this.GetComponent <Image>().color = Color.Lerp(CustomColor.GetColor(_color), CustomColor.GetColor(_alt), _timer * 1.5f); if (_timer * 1.5f >= 1) { _increase = !_increase; } } //then back to white else { _timer -= Time.deltaTime; this.GetComponent <Image>().color = Color.Lerp(CustomColor.GetColor(_color), CustomColor.GetColor(_alt), _timer * 1.5f); if (_timer * 1.5 <= 0) { _increase = !_increase; } } } //stop flashing if activated if (_achromic) { if (_r.transform.localScale.x == 0) { Full = false; } } } }
//something enters collector trigger void OnTriggerEnter2D(Collider2D col) { if (!Player.PlayerController.achromic) { //if it is an orb if (col.transform.tag.Equals("orb")) { //get the color and destroy the orb ----- ADD COLLECTING EFFECT LATER ColorPickup _orb = col.transform.GetComponent <ColorPickup>(); _player.AddColor(CustomColor.GetColor(_orb.ColorType), _orb.Amount); _orb.Collected(); } } }
protected override void StartUp() { //give a random delay for jumping _jumpDelay = Random.Range(_minDelay, _maxDelay); //give a random delay for attacking _attackDelay = Random.Range(_attackMinDelay, _attackMaxDelay); //store initial gravity _gravity = this.GetComponent <Rigidbody2D>().gravityScale; //find the particle system _particles = transform.Find("blade_particles").GetComponent <ParticleSystem>(); _particles.startColor = CustomColor.GetColor(_color); }
//Initialize the enemy public void Init() { //load the orb _orb = (GameObject)Resources.Load("Prefabs/orb"); //find the player _player = GameObject.Find("player"); ENEMY = LayerMask.NameToLayer("enemy"); GHOSTING_ENEMY = LayerMask.NameToLayer("ghosting_enemy"); //color parts that are supposed to be toned for (int i = 0; i < _coloredPieces.Length; i++) { _coloredPieces[i].material.color = CustomColor.GetColor(_color); } }
//Update UI spheres public void UpdateSpheres(ColorElement _color) { if (CustomColor.GetColor(_color).r > 0) { _r.UpdateSphereColor(ColorElement.Red); } else { _r.UpdateSphereColor(ColorElement.White); } if (CustomColor.GetColor(_color).g > 0) { _g.UpdateSphereColor(ColorElement.Green); } else { _g.UpdateSphereColor(ColorElement.White); } if (CustomColor.GetColor(_color).b > 0) { _b.UpdateSphereColor(ColorElement.Blue); } else { _b.UpdateSphereColor(ColorElement.White); } if (_color.Equals(ColorElement.Black)) { _r.UpdateSphereColor(ColorElement.Black); _g.UpdateSphereColor(ColorElement.Black); _b.UpdateSphereColor(ColorElement.Black); } }
//Update the UI sphere public void UpdateSphereColor(ColorElement _color) { _sphere.color = CustomColor.GetColor(_color); }
public void UpdateArmor(ColorElement _color) { this.renderer.material.color = CustomColor.GetColor(_color); }
public void UpdateArmor(ColorElement _color) { this.GetComponent <Renderer>().material.color = CustomColor.GetColor(_color); }