Пример #1
0
        public override void Awake()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            base.Awake();

            OnPlatformEnter = OnPlatformEnter ?? new PlatformCollisionEvent();
            OnPlatformStay  = OnPlatformStay ?? new PlatformCollisionEvent();
            OnPlatformExit  = OnPlatformExit ?? new PlatformCollisionEvent();

            OnSurfaceEnter = OnSurfaceEnter ?? new PlatformSurfaceEvent();
            OnSurfaceStay  = OnSurfaceStay ?? new PlatformSurfaceEvent();
            OnSurfaceExit  = OnSurfaceExit ?? new PlatformSurfaceEvent();

            CollisionRules      = new List <CollisionPredicate>();
            Collisions          = new List <TerrainCastHit>();
            _notifiedCollisions = new List <TerrainCastHit>();

            SurfaceRules               = new List <SurfacePredicate>();
            SurfaceCollisions          = new List <TerrainCastHit>();
            _notifiedSurfaceCollisions = new List <TerrainCastHit>();

            Parents = new List <PlatformTrigger>();
            GetComponentsInParent(true, Parents);
        }
Пример #2
0
        public override void Reset()
        {
            base.Reset();

            OnPlatformEnter = new PlatformCollisionEvent();
            OnPlatformStay  = new PlatformCollisionEvent();
            OnPlatformExit  = new PlatformCollisionEvent();

            OnSurfaceEnter = new PlatformSurfaceEvent();
            OnSurfaceStay  = new PlatformSurfaceEvent();
            OnSurfaceExit  = new PlatformSurfaceEvent();

            PlatformEnterSound    = PlatformLoopSound = PlatformExitSound =
                SurfaceEnterSound = SurfaceLoopSound = SurfaceExitSound = null;
        }