コード例 #1
0
ファイル: LadderBody.cs プロジェクト: belzecue/gridlike-Unity
        public override void OnTriggerStay2D(Collider2D o)
        {
            base.OnTriggerStay2D(o);

            PlatformerMotor2D motor = o.GetComponent <PlatformerMotor2D>();

            if (motor)
            {
                motor.LadderAreaEnter(_sprite.bounds, topHeight, bottomHeight);
            }
        }
コード例 #2
0
ファイル: LadderBody.cs プロジェクト: belzecue/gridlike-Unity
        public override void OnTriggerEnter2D(Collider2D o)
        {
            base.OnTriggerEnter2D(o);

            PlatformerMotor2D motor = o.GetComponent <PlatformerMotor2D>();

            if (motor)
            {
                // some games could want to enable auto bottom/top detection based on
                // restricted area... restrictedArea ? restrictedArea.bounds : _sprite.bounds
                motor.LadderAreaEnter(_sprite.bounds, topHeight, bottomHeight);

                if (enableRestrictedArea)
                {
                    motor.SetRestrictedArea(restrictedArea.bounds, disableRestrictedTop);
                }
                else
                {
                    motor.ClearRestrictedArea();
                }
            }
        }