예제 #1
0
파일: Manager.cs 프로젝트: tdang93/GAM-51
    private void FixedUpdate()
    {
        foreach (GravityObject GO1 in AllObjects)
        {
            foreach (GravityObject GO2 in AllObjects)
            {
                if (GO1 != GO2)
                {
                    //applyGravity(GO1, GO2);
                    //Debug.Log("applyGravity()");
                    applyFakeGravity(GO1, GO2);

                    if (GravityObject.verifyOverlap(GO1, GO2))
                    {
                        if (GO1.mass > GO2.mass)
                        {
                            for (int i = 0; i < consumeRate; i++)
                            {
                                GO1.consume(GO2);
                            }
                        }
                        else if (GO2.mass > GO1.mass)
                        {
                            for (int i = 0; i < consumeRate; i++)
                            {
                                GO2.consume(GO1);
                            }
                        }
                    }
                }
            }
        }
    }
    private void JustLoad_a_sample_avatar()
    {
        //instantiate character
        doit_AsyncLoad(true, go3 => {
            GameObject GO1;
            GameObject GO2;
            GameObject GO3;

            GO1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
            GO2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
            //GO3 = GameObject.CreatePrimitive(PrimitiveType.Cube);
            //GO3 = GameObject.Instantiate(PrefabsXR.instance.HMD_SimpleTestGO);
            GO1.GetComponent <BoxCollider>().enabled = false;
            GO2.GetComponent <BoxCollider>().enabled = false;

            GO1.transform.localScale = Vector3.one * 0.02f;
            GO2.transform.localScale = Vector3.one * 0.02f;

            //go3.name = "InstantiateOK_" + go3.name;
            go3.name = "avatar_" + this.name + "_" + go3.name;
            Debug.Log("instantiate - " + go3.name);

            /*
             * if (wisockiView.Get_Owner_IsLocal())
             * {
             *  GameObject lookAtPos;
             *  lookAtPos = new GameObject();
             *  lookAtPos.name = "lookAtPos";
             *  lookAtPos.transform.parent = Camera.main.transform;
             *  lookAtPos.transform.localPosition = new Vector3(0, 0, 0.5f);
             *  lookAtPos.transform.localRotation = default;
             *
             *  AvatarIK avatarIK;
             *  avatarIK = go3.GetComponent<AvatarIK>();
             *  if (avatarIK == null)
             *  {
             *      Debug.LogError("avatarIK not found");
             *      avatarIK = go3.AddComponent<AvatarIK>();
             *  }
             *  if (avatarIK != null)
             *      avatarIK.headObj = lookAtPos.transform;
             *
             *  go3.transform.localScale = Vector3.one * 1.0f;
             *  go3.SetActive(false);
             * }
             * else
             * {
             *  go3.transform.localScale = Vector3.one * 1.0f;
             *  NetGo3 = go3.AddComponent<NetSyncPlayerWsk>();
             * }*/

            GO3 = go3;

            //playerXR.GO3 = go;
        }, go3 => {
            //ERROR
            Debug.LogError("load avatar fail");
        });
    }