Exemplo n.º 1
0
    void FixedUpdate()
    {
        if (Controls.Instance.Trick == Controls.ControlState.Press)
        {
            Application.LoadLevel(0);
        }
        if (_binder == null)
        {
            if (s_checkedPoint.HasValue)
            {
                transform.position = s_checkedPoint.Value;
            }
            bindTo(getClosestBinder());
            var cam = FindObjectOfType <CameraController>();
            cam.transform.position = transform.position.WithZ(cam.transform.position.z);
        }
        if (Controls.Instance.Swap == Controls.ControlState.Press)
        {
            bindTo(getClosestBinder());
        }

        if (Controls.Instance.Trick == Controls.ControlState.Press)
        {
            GravitySetting.SwitchGravity();
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        var sh = col.GetComponent <SwitchHitter>();

        if (sh == null)
        {
            return;
        }

        if (Heavy == sh.Heavy)
        {
            if (TargetIsGravity)
            {
                GravitySetting.SwitchGravity();
            }
            else
            {
                foreach (var target in Targets)
                {
                    if (target != null)
                    {
                        target.SendMessage("OnSwitch");
                    }
                }
            }
            Destroy(gameObject);
        }
    }