Exemplo n.º 1
0
 private bool CreateSphere()
 {
     DestroyObject();
     CurGameObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
     InitObject();
     CurGameObject.AddComponent <GameSphere>();
     CurGameObject.GetComponent <GameSphere>().ObjectLogic = this;
     return(true);
 }
Exemplo n.º 2
0
        private void InitObject()
        {
            Material defaultMaterial = null;

            foreach (var it in Resources.FindObjectsOfTypeAll(typeof(Material)))
            {
                if (it.name == PLAYER_MAT_NAME)
                {
                    defaultMaterial = it as Material;
                    break;
                }
            }

            CurGameObject.transform.position = INIT_POS;
            CurGameObject.GetComponent <MeshRenderer>().material = defaultMaterial;
            Rigidbody rigidbody = CurGameObject.AddComponent <Rigidbody>() as Rigidbody;

            rigidbody.useGravity = false;
            rigidbody.mass       = 1;
        }