Exemplo n.º 1
0
    void InitPhysics()
    {
        Rigidbody rb = gameObject.AddComponent <Rigidbody>();

        rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
        rb.angularDrag = 5.0f;
        rb.mass        = 1f;
        rb.drag        = 1f;
        RXWatcher.Watch(rb);

        boxCollider      = gameObject.AddComponent <BoxCollider>();
        boxCollider.size = new Vector3(sprite.width, sprite.height, 100) * FPhysics.POINTS_TO_METERS;

        PhysicMaterial mat = new PhysicMaterial();

        mat.bounciness      = 0.3f;
        mat.dynamicFriction = 0.5f;
        mat.staticFriction  = 0.5f;
        mat.frictionCombine = PhysicMaterialCombine.Maximum;
        collider.material   = mat;

        float   speed       = 30.0f;
        float   angle       = RXRandom.Range(0, RXMath.DOUBLE_PI);
        Vector2 startVector = new Vector2(Mathf.Cos(angle) * speed, Mathf.Sin(angle) * speed);

        rb.velocity = startVector.ToVector3InMeters();
    }
Exemplo n.º 2
0
    override public void Start()
    {
        ListenForUpdate(HandleUpdate);

        st = new SimpleTimer();
        st.Start();

        gameNodes = new FContainer();
        Futile.atlasManager.LoadImage("car");

        WEHTiled hurr = new WEHTiled("track");

        gameNodes.AddChild(hurr.DrawLayer(0));
        FContainer coll = hurr.DrawLayer(1);

        gameNodes.AddChild(coll);

        c          = new Car(Futile.atlasManager.GetElementWithName("car"), coll);
        c.x        = Futile.screen.width;
        c.y        = -Futile.screen.height;
        c.rotation = 90;
        gameNodes.AddChild(c);

        lapCollider        = new FSprite(Futile.whiteElement);
        lapCollider.scaleY = 5;
        lapCollider.SetPosition(1220, -832);
        lapCollider.alpha = 0;
        gameNodes.AddChild(lapCollider);

        RXWatcher.Watch(gameNodes);
        RXWatcher.Watch(lapCollider);

        this.AddChild(gameNodes);
        SetupUI();
    }
Exemplo n.º 3
0
    override public void Start()
    {
        Futile.atlasManager.LoadImage("chopper");
        Futile.atlasManager.LoadImage("man");

        this.AddChild(persons = new FContainer());

        ListenForUpdate(HandleUpdate);
        root = FPWorld.Create(64.0f);


        for (int i = 0; i < 50; i++)
        {
            Platform p = Platform.Create();
            p.Init(new Vector2(i * 250, RXRandom.Range(-100, 100) * i), this);
            Person b = Person.Create();
            b.Init(new Vector2(p.sprite.x, p.sprite.y + 532), this);
            b.GameOver = HandleGameOver;
        }


        c = Chopper.Create();
        c.Init(new Vector2(0, 128), this);

        RXWatcher.Watch(this);
        Futile.stage.Follow(c.sprite, false, false);
    }
Exemplo n.º 4
0
 static HumanConfig()
 {
     RXWatcher.Watch(typeof(HumanConfig));
 }
Exemplo n.º 5
0
 static WolfConfig()
 {
     RXWatcher.Watch(typeof(WolfConfig));
 }