Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    public void initialize(GameObject useMe)
    {
        //hardcode in the desired joints
        mImportant[ZgJointId.Torso]         = new Stupid(new ZgJointId[] { ZgJointId.LeftShoulder, ZgJointId.Neck, ZgJointId.RightShoulder, ZgJointId.Waist });
        mImportant[ZgJointId.Waist]         = new Stupid(new ZgJointId[] { ZgJointId.RightHip, ZgJointId.LeftHip });
        mImportant[ZgJointId.LeftShoulder]  = new Stupid(ZgJointId.LeftElbow);
        mImportant[ZgJointId.LeftElbow]     = new Stupid(ZgJointId.LeftHand);
        mImportant[ZgJointId.LeftHip]       = new Stupid(ZgJointId.LeftKnee);
        mImportant[ZgJointId.LeftKnee]      = new Stupid(ZgJointId.LeftAnkle);
        mImportant[ZgJointId.RightShoulder] = new Stupid(ZgJointId.RightElbow);
        mImportant[ZgJointId.RightElbow]    = new Stupid(ZgJointId.RightHand);
        mImportant[ZgJointId.RightHip]      = new Stupid(ZgJointId.RightKnee);
        mImportant[ZgJointId.RightKnee]     = new Stupid(ZgJointId.RightAnkle);
        mImportant[ZgJointId.Neck]          = new Stupid(ZgJointId.Head);
        mImportant[ZgJointId.Head]          = new Stupid();
        mImportant[ZgJointId.LeftHand]      = new Stupid();
        mImportant[ZgJointId.RightHand]     = new Stupid();
        mImportant[ZgJointId.LeftAnkle]     = new Stupid();
        mImportant[ZgJointId.RightAnkle]    = new Stupid();


        //initialize FarseerPhysics
        mWorld = useMe.AddComponent <FSWorldComponent>();

        //var debug = Camera.allCameras[0].gameObject.AddComponent<FSDebugDrawComponent>();
        //debug.GLMaterial = useMe.GetComponent<NewMenuReferenceBehaviour>().farseerMaterial;
    }
Ejemplo n.º 2
0
    //float time1 = 0;
    //float time2 = 0;
    void Awake()
    {
        //Application.targetFrameRate = 6000;

        instance = this;
        world = new World(new FVector2(Gravity.x, Gravity.y));

        StartCoroutine ("WorldCourutine");
        //InvokeRepeating ("UpdateWorld", 0f, 0.0333f);
    }
Ejemplo n.º 3
0
	// Use this for initialization
	void Start () 
	{
		world = GetComponent<FSWorldComponent>();
		myMass = transform.GetComponent<FSBodyComponent>().PhysicsBody.Mass;
		planetBodies = new Body[planets.Length];
		int i = 0;
		foreach(GameObject planet in planets)
		{
			Vector2 initForce = planet.GetComponent<PlanetController>().calcInitForce(transform);
			Body planetBody = planet.GetComponent<FSBodyComponent>().PhysicsBody;
			
			initForce = initForce * forceScale;
			planetBody.ApplyForce(new FVector2(initForce.x, initForce.y));
			planetBodies[i] = planetBody;  
			i++;
		}
	}
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        world        = GetComponent <FSWorldComponent>();
        myMass       = transform.GetComponent <FSBodyComponent>().PhysicsBody.Mass;
        planetBodies = new Body[planets.Length];
        int i = 0;

        foreach (GameObject planet in planets)
        {
            Vector2 initForce  = planet.GetComponent <PlanetController>().calcInitForce(transform);
            Body    planetBody = planet.GetComponent <FSBodyComponent>().PhysicsBody;

            initForce = initForce * forceScale;
            planetBody.ApplyForce(new FVector2(initForce.x, initForce.y));
            planetBodies[i] = planetBody;
            i++;
        }
    }
Ejemplo n.º 5
0
 void Awake()
 {
     instance = this;
     world = new World(new FVector2(Gravity.x, Gravity.y));
 }
Ejemplo n.º 6
0
 void Awake()
 {
     instance = this;
     world    = new World(new FVector2(Gravity.x, Gravity.y));
 }