void Start()
        {
            payload            = new BoundableObjectPayload();
            payload.GameObject = gameObject;
            payload.Type       = BoundableObjectPayload.BehaviourType.Destroyable;

            Messenger.Default.Subscribe <CollisionPayload>(OnCollision, CollisionPredicate);
        }
Exemple #2
0
 private void OnSpaceshipPosition(BoundableObjectPayload boundable)
 {
     if (boundable.Type == BoundableObjectPayload.BehaviourType.Repositionable)
     {
         Reposition(boundable.GameObject);
     }
     else if (boundable.Type == BoundableObjectPayload.BehaviourType.Destroyable)
     {
         Destroy(boundable.GameObject);
     }
 }
        void Start()
        {
            speed = Random.Range(MIN_SPEED, MAX_SPEED);

            transform.Rotate(new Vector3(0, 0, Random.Range(0, 360)));

            boundsPayload            = new BoundableObjectPayload();
            boundsPayload.GameObject = gameObject;
            boundsPayload.Type       = BoundableObjectPayload.BehaviourType.Repositionable;

            collisionPayload = new CollisionPayload();
        }
Exemple #4
0
        private bool SpacePositionPredicate(BoundableObjectPayload boundable)
        {
            Vector3 position = boundable.GameObject.transform.position;

            if (position.x > right.transform.position.x)
            {
                return(true);
            }
            else if (position.x < left.transform.position.x)
            {
                return(true);
            }
            else if (position.y > top.transform.position.y)
            {
                return(true);
            }
            else if (position.y < bot.transform.position.y)
            {
                return(true);
            }

            return(false);
        }