当前位置: 首页>>代码示例>>C#>>正文


C# Root.setColour方法代码示例

本文整理汇总了C#中Root.setColour方法的典型用法代码示例。如果您正苦于以下问题:C# Root.setColour方法的具体用法?C# Root.setColour怎么用?C# Root.setColour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Root的用法示例。


在下文中一共展示了Root.setColour方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        _t = transform;
        name = "creature" + gameObject.GetInstanceID();

        eth = Ether.getInstance();
        settings = Settings.getInstance();
        crt_count = GameObject.Find("CreatureCount").GetComponent<CreatureCount>();

        max_root_scale = new Vector3();
        max_root_scale.x = float.Parse( settings.contents["creature"]["root"]["max_root_scale"]["x"].ToString() );
        max_root_scale.y = float.Parse( settings.contents["creature"]["root"]["max_root_scale"]["y"].ToString() );
        max_root_scale.z = float.Parse( settings.contents["creature"]["root"]["max_root_scale"]["z"].ToString() );

        min_root_scale = new Vector3();
        min_root_scale.x = float.Parse( settings.contents["creature"]["root"]["min_root_scale"]["x"].ToString() );
        min_root_scale.y = float.Parse( settings.contents["creature"]["root"]["min_root_scale"]["y"].ToString() );
        min_root_scale.z = float.Parse( settings.contents["creature"]["root"]["min_root_scale"]["z"].ToString() );

        root = GameObject.CreatePrimitive(PrimitiveType.Cube);
        root.name = "root";
        root.transform.parent 			= _t;
        root.transform.position 		= _t.position;
        root.transform.eulerAngles 		= _t.eulerAngles;
        root.AddComponent<Rigidbody>();
        root_script = root.AddComponent<Root>();
        root_script.setColour(chromosome.getColour());
        root_script.setScale(chromosome.getRootScale());
        //root.rigidbody.mass = 15F;
        root.GetComponent<Rigidbody>().angularDrag 	= float.Parse( settings.contents["creature"]["angular_drag"].ToString() );
        root.GetComponent<Rigidbody>().drag 				= float.Parse( settings.contents["creature"]["drag"].ToString() );
        eye = new GameObject();
        eye.name = "Eye";
        eye.transform.parent 			= root.transform;
        eye.transform.eulerAngles 		= root.transform.eulerAngles;
        eye.transform.position 			= root.transform.position;
        eye_script = eye.AddComponent<Eye>();

        mouth = new GameObject();
        mouth.name = "Mouth";
        mouth.transform.parent 			= root.transform;
        mouth.transform.eulerAngles 	= root.transform.eulerAngles;
        mouth.transform.localPosition 	= new Vector3(0,0,.5F);
        mouth.AddComponent<Mouth>();

        genital = new GameObject();
        genital.name = "Genital";
        genital.transform.parent 		= root.transform;
        genital.transform.eulerAngles 	= root.transform.eulerAngles;
        genital.transform.localPosition	= new Vector3(0,0,-.5F);
        genital.AddComponent<Genitalia>();

        line_of_sight 		= (double) 	settings.contents ["creature"]["line_of_sight"];
        metabolic_rate 		= (double) 	settings.contents ["creature"]["metabolic_rate"];
        age_sexual_maturity = (int)		settings.contents ["creature"]["age_sexual_maturity"];

        setupLimbs();

        age = 0.0D;
        state = State.neutral;
        food_eaten = 0;
        offspring = 0;

        InvokeRepeating("updateState",0,0.1f);
        InvokeRepeating("metabolise",1.0f,1.0f);
        InvokeRepeating("RandomDirection", 1F, 5F);

        root.GetComponent<Rigidbody>().SetDensity(4F);
    }
开发者ID:clomax,项目名称:evosim,代码行数:69,代码来源:Creature.cs


注:本文中的Root.setColour方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。