Пример #1
0
 public void AddTeammate(Hero hero)
 {
     mTeammates.Add(hero.ID, hero);
     while (BeehiveCell.Count < mTeammates.Count)
     {
         BeehiveCell.AddCell();
     }
     SortHeroList();
     mFollowDist = BeehiveCell.Tier * BeehiveCell.Radius * 2;
 }
Пример #2
0
 public void RemoveTeammate(long heroId)
 {
     mTeammates.Remove(heroId);
     while (BeehiveCell.Count > mTeammates.Count)
     {
         BeehiveCell.RemoveCell();
     }
     SortHeroList();
     mFollowDist = BeehiveCell.Tier * BeehiveCell.Radius * 2;
 }
Пример #3
0
    public override void OnUpdate()
    {
        base.OnUpdate();

        if (!IsMoving)
        {
            mDeltaTime += Time.deltaTime;
            if (mDeltaTime >= 3f)
            {
                mIsCoundDown = true;
                foreach (Hero hero in mTeammates.Values)
                {
                    if (hero.AttackTarget == null &&
                        hero.MovingDirection != Vector3.zero &&
                        XUtility.DistanceNoY(hero.position, transform.position) <= mFollowDist)
                    {
                        hero.FollowPoint = hero.position;
                        hero.StopMoveToPoint();
                    }
                }
            }
        }
        else
        {
            mIsCoundDown = false;
            mDeltaTime   = 0;
        }

        #region 蜂窝站位
        if (mDistList != null && !mIsCoundDown)
        {
            for (int i = 0, len = mDistList.Count; i < len; i++)
            {
                mDistDict[mDistList[i]].FollowPoint = transform.TransformPoint(BeehiveCell.GetBeehivePos(i));
            }
            //mCurSpeed = Mathf.Lerp(Attr.MoveSpeed, 0, Mathf.Max(0, mMaxDist - BeehiveCell.CellTier(mTeammates.Count)) / 10f);
        }
        #endregion

#if UNITY_EDITOR
        Debug.DrawRay(transform.position, Vector3.up * 100, Color.red);
#endif
    }