Esempio n. 1
0
 /// <summary>
 /// 退出回调
 /// </summary>
 public override void onExit(MapCharacter character)
 {
     base.onExit(character);
     if (entries.Contains(character))
     {
         entries.Remove(character);
     }
 }
Esempio n. 2
0
 bool _removePassenger(MapCharacter character)
 {
     if (passengers.removeSubView(character))
     {
         onLand(character); return(true);
     }
     return(false);
 }
Esempio n. 3
0
 bool _addPassenger(MapCharacter character)
 {
     if (passengers.addSubView(character))
     {
         onBoard(character); return(true);
     }
     return(false);
 }
Esempio n. 4
0
 /// <summary>
 /// 进入回调
 /// </summary>
 public override void onEnter(MapCharacter character)
 {
     base.onEnter(character);
     if (!entries.Contains(character))
     {
         entries.Add(character);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 下车回调
        /// </summary>
        /// <param name="character"></param>
        protected virtual void onLand(MapCharacter character)
        {
            if (hidePassengers)
            {
                character.activate();
            }

            character.vehicle          = null;
            character.collider.enabled = true;
            character.pos = (Vector2)landPoint;
            stop();

            landPoint = null;

            freezing = freezeTime;
        }
Esempio n. 6
0
        /// <summary>
        /// 上车回调
        /// </summary>
        /// <param name="character"></param>
        protected virtual void onBoard(MapCharacter character)
        {
            if (hidePassengers)
            {
                character.deactivate();
            }

            character.vehicle                 = this;
            character.collider.enabled        = false;
            character.transform.localPosition = offset;
            character.stop();

            //updatePassengers();

            freezing = freezeTime;
        }
Esempio n. 7
0
 /// <summary>
 /// 是否在上车区域中
 /// </summary>
 /// <returns></returns>
 bool isInBoardingRegions(MapCharacter character)
 {
     return(boardingRegion && boardingRegion.isEnter(character));
 }
Esempio n. 8
0
 /// <summary>
 /// 能否上车
 /// </summary>
 /// <returns></returns>
 public virtual bool isBoardingValid(MapCharacter character)
 {
     return(!isFreezing() && !isFull() && isInBoardingRegions(character));
 }
Esempio n. 9
0
 /// <summary>
 /// 移除乘客
 /// </summary>
 /// <param name="entity"></param>
 public bool removePassenger(MapCharacter character)
 {
     return(isLandingValid() && _removePassenger(character));
 }
Esempio n. 10
0
 /// <summary>
 /// 添加乘客
 /// </summary>
 public bool addPassenger(MapCharacter character, bool force = false)
 {
     return((force || isBoardingValid(character)) &&
            _addPassenger(character));
 }
Esempio n. 11
0
 /// <summary>
 /// 是否存在指定乘客
 /// </summary>
 /// <param name="character"></param>
 /// <returns></returns>
 public bool hasPassenger(MapCharacter character)
 {
     return(passengers.hasSubView(character));
 }
Esempio n. 12
0
 /// <summary>
 /// 区域退出回调
 /// </summary>
 public virtual void onExit(MapCharacter character)
 {
 }
Esempio n. 13
0
 /// <summary>
 /// 区域持续回调
 /// </summary>
 public virtual void onStay(MapCharacter character)
 {
 }
Esempio n. 14
0
 /// <summary>
 /// 区域进入回调
 /// </summary>
 public virtual void onEnter(MapCharacter character)
 {
 }
Esempio n. 15
0
 /// <summary>
 /// 是否在区域内
 /// </summary>
 /// <returns></returns>
 public bool isEnter(MapCharacter character)
 {
     return(entries.Contains(character));
 }