Exemplo n.º 1
0
    /// <summary>
    /// Set hthe color of an item.
    /// </summary>
    /// <param name="color"></param>
    public void SetColor(RayColor color)
    {
        Color = color;
        var _image = this.GetComponentInChildren <Image>();
        var _text  = this.GetComponentInChildren <Text>();

        _text.text   = Color.GetName();
        _image.color = Color.GetColor();
    }
Exemplo n.º 2
0
 /// <summary>
 /// Change the color of an item.
 /// </summary>
 public void ChangeColor()
 {
     Debug.LogWarning(Color.GetName());
     if (GameManager.Instance != null)
     {
         GameManager.Instance.SetSelectedItemColor(Color);
         GameManager.Instance.HideColorPanel();
     }
     else if (LevelEditorTD.Instance != null)
     {
         LevelEditorTD.Instance.SetSelectedItemColor(Color);
         LevelEditorTD.Instance.HideColorPanel();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Deal the damage to an ennemy.
        /// </summary>
        /// <param name="enemy"></param>
        private void Damage(Component enemy)
        {
            var enemyBehaviour = enemy.GetComponent <EnemyBehaviour>();

            if (enemyBehaviour == null)
            {
                return;
            }

            var damage = CalculateDamage(enemyBehaviour.Color);

            enemyBehaviour.Life -= damage;
            Debug.Log(string.Format("{0} bullet hit a {1} enemy causing {2} damage ({3} remaining)",
                                    Color.GetName(),
                                    enemyBehaviour.Color.GetName(),
                                    damage,
                                    enemyBehaviour.Life
                                    ));
        }