Exemple #1
0
 private void Press(object sender, MoveEventArgs e)
 {
     Pushed = true;
     OnPress?.Invoke(this, Color);
     GateBehavior.SendMessage(GateBehavior.GateMsg.Open, Color);
     pressingButton = sender;
 }
    void Start()
    {
        trig     = GameObject.Find("StoryElement").GetComponent <StoryTrigger>();
        triggers = GameObject.FindGameObjectsWithTag("storypad");

        abcTriggerGroup = GameObject.Find("ABCTriggerGroup").GetComponent <TriggerGroupBehaviour>();
        gate            = GameObject.Find("Gateway").GetComponent <GateBehavior>();
        targets         = GameObject.Find("Targets").GetComponent <TargetGroupBehavior>();
        trap            = GameObject.Find("TrapWall").GetComponent <TrapBehaviour>();

        // these are used to refer the index of each trigger
        abcTriggers = new char[] { 'A', 'B', 'C' };

        gate         = GameObject.Find("Gateway").GetComponent <GateBehavior>();
        targets      = GameObject.Find("Targets").GetComponent <TargetGroupBehavior>();
        nextRoom     = GameObject.Find("NextRoom").GetComponent <NextRoomBehaviour>();
        nextRoomDoor = GameObject.Find("NextRoomDoor").GetComponent <NextRoomDoorBehaviour>();


        bll = GameObject.Find("Ball").GetComponent <BallBehaviour>();

        print("bll " + bll);
        print("abc  " + abcTriggerGroup);

        tasktext.text = "Task: Hit a story panel."; // Set initial task text
    }
Exemple #3
0
    private void Unpress(object sender, MoveEventArgs e)
    {
        Pushed = false;

        OnUnpress?.Invoke(this, Color);
        GateBehavior.SendMessage(GateBehavior.GateMsg.Close, Color);
        pressingButton = null;
    }
Exemple #4
0
        CollisionShape _AddGateWire(GateBehavior gate, GateWireBehavior wire)
        {
            var gt = gate.gameObject.transform;
            var wireMeshe = wire.gameObject.GetComponentsInChildren<MeshFilter>(true)[0];

            var meshSize = wireMeshe.mesh.bounds.size * gt.localScale.z;

            _thickness = meshSize.y;
            _length = meshSize.x;
            _barHeight = meshSize.z;

            base.offset = new Vector3(0, 0, _barHeight * 0.70f);
            return new BoxShape(_length * 0.5f, _thickness * 0.5f, _barHeight * 0.25f); // bar = 30% of height
        }
Exemple #5
0
        public PhyGate(GateBehavior gate, GateWireBehavior wire) : base(PhyType.Gate)
        {
            Mass = 0.4f; // why gates don't have mass?

            _rotation = gate.data.Rotation.ToRad();
            _startAngle = gate.data.AngleMin - 10.0f.ToRad();
            _endAngle = gate.data.AngleMax + 10.0f.ToRad();
            _type = gate.data.TwoWay ? GateType.TwoWay : GateType.OneWay;
            //s_type = GateType.TwoWays;
            if (_type == GateType.TwoWay)
                _startAngle = -_endAngle;

            //RotationDirection = flipper.data.StartAngle > flipper.data.EndAngle ? -1 : 1;
            //_height = flipper.data.Height;
            //_startAngle = flipper.data.StartAngle * Mathf.PI / 180.0f;
            //_endAngle = flipper.data.EndAngle * Mathf.PI / 180.0f;

            SetupRigidBody(Mass, _AddGateWire(gate, wire));

            SetProperties(
                Mass,
                gate.data.Friction,
                gate.data.Elasticity * 100.0f);
            body.SetDamping(gate.data.Damping, gate.data.Damping);

            // calc position of wire like from gate
            Matrix4x4 m = Matrix4x4.TRS(
                gate.gameObject.transform.localPosition,
                gate.gameObject.transform.localRotation,
                UnityEngine.Vector3.one
                );

            // wire is drawed as child of gate, so position & rotation is relative to gate
            // we need also calc transformation from physics coords system to "gate relative" coords
            var m2 = m;
            m *= Matrix4x4.Translate(-offset.ToUnity());

            base.matrix = m.ToBullet();            
            base.localToWorld = m2.inverse;
            base.name = gate.name;
            base.entity = Entity.Null;
        }
Exemple #6
0
 private void OnDestroy()
 {
     TileMovingObjectScript.MoveableMoving -= Spongebob_PlayerPositionChanging;
     GateBehavior.SendMessage(GateBehavior.GateMsg.Close, Color);
 }
 protected override void OnEnable()
 {
     base.OnEnable();
     _gate = target as GateBehavior;
 }