view Assets/Application/Scripts/ParentObject.cs @ 4:2878be4487ec

add Maping Code.
author Kazuma
date Tue, 08 Nov 2016 17:07:48 +0900
parents
children
line wrap: on
line source

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ParentObject : MonoBehaviour {

	public GameObject Value;
	public NodePath Path;
	public Dictionary<string, Component> dic = new Dictionary<string, Component>();

	public ParentObject (GameObject value, NodePath path) {
		this.Value = value;
		this.Path = path;
		GetComponent ();
		Logs ();
	}

	public void GetComponent () {
		Component[] comps = this.Value.GetComponents<Component>();
		foreach (Component component in comps) {
			Debug.Log(component.GetType().ToString());
			dic.Add (component.GetType().ToString(), component);
		}
	}

	public void Logs () {
		string s = "<";
		foreach (int num in Path) {
			s += num + ",";
		}
		s += ">";
		print (s);
	}
}