Пример #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();
    }
Пример #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();
    }
Пример #3
0
    static public void Watch(object target, bool shouldShowNonPublic, string targetName)
    {
        if (target == null)
        {
            return;
        }

        if (targetName == null)
        {
            if (target is Type)
            {
                targetName = (target as Type).Name;
            }
            else
            {
                targetName = target.GetType().Name;
            }
        }

        if (_instance == null)
        {
            _instance = new RXWatcher();
        }

        _instance.DoWatch(target, targetName, shouldShowNonPublic);
    }
Пример #4
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);
    }
Пример #5
0
    public static RXWatchTarget GetTarget()
    {
        if (_instance == null)
        {
            _instance = new RXWatcher();
        }

        return(_instance.watchTarget);
    }
Пример #6
0
    static public void Watch(object target, bool shouldShowNonPublic, string targetName)
    {
        if (target == null)
        {
            return;
        }

        if (targetName == null)
        {
            if (target is Type)
            {
                targetName = (target as Type).Name;
            }
            else
            {
                targetName = target.GetType().Name;
                FLabel targetAsLbl = target as FLabel;
                if (targetAsLbl != null)
                {
                    targetName += " - '" + targetAsLbl.text + "'";
                }
                else
                {
                    FSprite targetAsSprite = target as FSprite;
                    if (targetAsSprite != null)
                    {
                        targetName += " - '" + targetAsSprite.element.name + "'";
                    }
                }
            }
        }

        if (_instance == null)
        {
            _instance = new RXWatcher();
        }

        _instance.DoWatch(target, targetName, shouldShowNonPublic);
    }
Пример #7
0
    public static void Watch(object target, bool shouldShowNonPublic, string targetName)
    {
        if(target == null) return;

        if(targetName == null)
        {
            if(target is Type)
            {
                targetName = (target as Type).Name;
            }
            else
            {
                targetName = target.GetType().Name;
            }
        }

        if(_instance == null)
        {
            _instance = new RXWatcher();
        }

        _instance.DoWatch(target, targetName, shouldShowNonPublic);
    }
Пример #8
0
	static public void Watch(object target, bool shouldShowNonPublic, string targetName)
	{
		if(target == null) return;

		if(targetName == null)
		{
			if(target is Type)
			{
				targetName = (target as Type).Name;
			}
			else
			{
				targetName = target.GetType().Name;
				FLabel targetAsLbl = target as FLabel;
				if (targetAsLbl != null)
				{
					targetName += " - '" + targetAsLbl.text + "'";
				}
				else
				{
					FSprite targetAsSprite = target as FSprite;
					if (targetAsSprite != null)
					{
						targetName += " - '" + targetAsSprite.element.name + "'";
					}
				}
			}
		}

		if(_instance == null)
		{
			_instance = new RXWatcher();
		}
		
		_instance.DoWatch(target, targetName, shouldShowNonPublic);
	}
Пример #9
0
 private void Destroy()
 {
     UnityEngine.Object.Destroy(gameObject);
     RXWatcher.RemoveWatcherLink(this);
 }
Пример #10
0
 static HumanConfig()
 {
     RXWatcher.Watch(typeof(HumanConfig));
 }
Пример #11
0
 static WolfConfig()
 {
     RXWatcher.Watch(typeof(WolfConfig));
 }
Пример #12
0
    public static RXWatchTarget GetTarget()
    {
        if(_instance == null) _instance = new RXWatcher();

        return _instance.watchTarget;
    }