Exemplo n.º 1
0
        void OnTriggerStay(Collider other)
        {
            PlatformRider passenger = other.transform.root.GetComponentInChildren <PlatformRider> ();

            if (passenger == null || passengers.Contains(passenger))
            {
                return;
            }

            if (passenger.BoardPlatform(this))
            {
                BoardPlatform(passenger);
            }
        }
Exemplo n.º 2
0
        void LateUpdate()
        {
            Vector3 delta = transform.position - lastPosition;

            if (delta != Vector3.zero)
            {
                for (int i = 0; i < passengers.Count;)
                {
                    PlatformRider passenger = passengers[i];
                    bool          didUpdate = false;

                    foreach (Collider collider in passenger.transform.root.GetComponentsInChildren <Collider> ())
                    {
                        if (
                            ContainsPoint(passenger.transform.position) ||
                            (Vector3.Dot(passenger.transform.position - transform.position, transform.up) > 0.0f && IntersectingTrigger(collider))
                            )
                        {
                            passenger.UpdatePlatform(delta);
                            didUpdate = true;
                            break;
                        }
                    }

                    if (!didUpdate && passenger.LeavePlatform(this))
                    {
                        LeavePlatform(passenger);
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            lastPosition = transform.position;
        }
Exemplo n.º 3
0
 public void LeavePlatform(PlatformRider passenger)
 {
     passengers.Remove(passenger);
 }
Exemplo n.º 4
0
 public void BoardPlatform(PlatformRider passenger)
 {
     passengers.Add(passenger);
 }
Exemplo n.º 5
0
		public void LeavePlatform (PlatformRider passenger)
		{
			passengers.Remove (passenger);
		}
Exemplo n.º 6
0
		public void BoardPlatform (PlatformRider passenger)
		{
			passengers.Add (passenger);
		}