using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.InputSystem;
    
    public class Player
    {
        /*省略*/

        Color damageColor;
        Transform children; 
        
void Start() { /*省略*/ children = this.gameObject.GetComponentInChildren(); damageColor = new Color( 1.0f, 0.5f, 0.5f, 0.5f); }
//ダメージ処理 private void Damage() { if( damageTime < 1){ /*省略*/ SetMaterialColor( damageColor); } }
//マテリアルの色を設定する private void SetMaterialColor(Color _color){ //子要素がいなければ終了 if (children.childCount == 0){ return; } foreach( Transform obj in children){ if( obj.name == "bone_1") return; obj.GetComponent().material.color = _color; } } }