Ejemplo n.º 1
0
        public Railway.Point AddPoint(Vector3 pos
                                      , int prePointId
                                      , Point.EType type = Point.EType.Joint
                                      , int pointId      = -1)
        {
            if (GetPoint(pointId) != null)
            {
                return(null);
            }

            if (pointId == InvalId)
            {
                pointId = GetValidPointId();
            }

            Railway.Point point = new Railway.Point(pointId, type);
            point.position = pos;

            if (type == Railway.Point.EType.Station)
            {
                point.stayTime = Railway.Manager.DefaultStayTime;
            }
            else if (type == Railway.Point.EType.End)
            {
                point.stayTime = Railway.Manager.DefaultStayTime;// / 2f;
            }
            else
            {
                point.stayTime = 0f;
            }

            mPointDic[point.id] = point;

            point.ChangePrePoint(prePointId);

            pointChangedEventor.Dispatch(new PointChanged()
            {
                bAdd  = true,
                point = point
            });

            return(point);
        }
Ejemplo n.º 2
0
        public void Destroy()
        {
            Railway.Point getPoint = GetPrePoint();
            if (null != getPoint)
            {
                getPoint.ChangeNextPoint(Railway.Manager.InvalId);
            }

            getPoint = GetNextPoint();

            if (null != getPoint)
            {
                getPoint.ChangePrePoint(Railway.Manager.InvalId);
            }

            if (null != station)
            {
                GameObject.Destroy(station.gameObject);
            }
        }
Ejemplo n.º 3
0
        public void ChangeNextPoint(int nextID)
        {
            if (nextID == nextPointId)
            {
                return;
            }

            Railway.Point oldNextPoint = GetNextPoint();

            nextPointId = nextID;

            if (null != oldNextPoint)
            {
                oldNextPoint.ChangePrePoint(Railway.Manager.InvalId);
            }

            Railway.Point newNextPoint = Railway.Manager.Instance.GetPoint(nextID);
            if (null != newNextPoint)
            {
                newNextPoint.ChangePrePoint(id);
            }

            UpdateRotation();
        }