示例#1
0
        public void DrawWay(float deltaTime, WayType wayType = WayType.MAINSTREET)
        {
            timeInWay += deltaTime * GetSpeedModifier();
            lineRenderer.positionCount = 1;
            lineRenderer.SetPosition(0, startPlace.GetPoint().transform.position);
            float timeToPoint = 0;

            for (int i = 0; i < curWay.pointsAndPaths.Count; i++)
            {
                iWayPlace place = curWay.pointsAndPaths[i];
                timeToPoint += place.GetTimeToWay();
                if (place is PointOnMap)
                {
                    lineRenderer.positionCount++;
                    Vector3 wayPoint = new Vector3(place.GetPoint().transform.position.x, place.GetPoint().transform.position.y, place.GetPoint().transform.position.z + 0.01f * Agency.GetInstantiate().teams.IndexOf(this));
                    lineRenderer.SetPosition(lineRenderer.positionCount - 1, wayPoint);
                }
                else if (place is Path)
                {
                    if (timeToPoint > timeInWay)
                    {
                        lineRenderer.positionCount++;
                        float      part       = (timeInWay - timeToPoint + place.GetTimeToWay()) / place.GetTimeToWay();
                        PointOnMap end        = (PointOnMap)curWay.pointsAndPaths[i + 1];
                        Vector3    partVector = ((Path)place).GetPointOnPath(end, part);
                        Vector3    wayPoint   = new Vector3(partVector.x, partVector.y, partVector.z + 0.01f * Agency.GetInstantiate().teams.IndexOf(this));
                        lineRenderer.SetPosition(lineRenderer.positionCount - 1, wayPoint);
                    }
                }
                MapManager mapManager = MapManager.GetInstantiate();
                if (detectives[0].activityPlace is iWayPlace && (iWayPlace)detectives[0].activityPlace == place)
                {
                    if (timeToPoint <= timeInWay)
                    {
                        if (i == curWay.pointsAndPaths.Count - 1)
                        {
                            if (curTarget is Office)
                            {
                                ChangeActivity(DetectiveActivity.IN_OFFICE, curTarget);
                            }
                            else if (curTarget is DetectiveHome)
                            {
                                ChangeActivity(DetectiveActivity.IN_HOME, curTarget);
                            }
                            else if (curTarget is QuestEvent)
                            {
                                ChangeActivity(DetectiveActivity.IN_EVENT, curTarget);
                            }
                            Destroy(curWay.gameObject);
                        }
                        else
                        {
                            ChangeActivity(DetectiveActivity.IN_WAY, curWay.pointsAndPaths[i + 1]);
                        }
                    }
                    break;
                }
            }
        }
示例#2
0
 public void GoTo(iActivityPlace target, WayType wayType, bool colorWay)
 {
     curTarget = target;
     ResetWayColor();
     curWay  = MapManager.GetInstantiate().pathfinder.GetWay(wayType, startPlace.GetPoint(), target.GetPoint(), transform);
     showWay = colorWay;
     ChangeActivity(DetectiveActivity.IN_WAY, curWay.pointsAndPaths[0]);
 }
示例#3
0
        public void SetPosition(float position)
        {
            MapManager mapManager = MapManager.GetInstantiate();

            if (Mathf.Abs(position - curPosition) > mapManager.deltaPosTier)
            {
                curPosition = position;
                changePos   = true;
                timePos     = 0;
            }
        }
示例#4
0
        private void Start()
        {
            MapManager mapManager = MapManager.GetInstantiate();

            ClearAllPaths();
            foreach (Path path in mapManager.instanceRing.paths)
            {
                path.points[0].avaliablePaths.Add(path);
                path.points[1].avaliablePaths.Add(path);
            }
        }
示例#5
0
        private void Awake()
        {
            GetInstantiate();

            DontDestroyOnLoad(instance);
            ControlManager.GetInstantiate();
            DetectiveManager.GetInstantiate();
            TraitManager.GetInstantiate();
            ItemManager.GetInstantiate();
            QuestManager.GetInstantiate();
            MapManager.GetInstantiate();
            DialogManager.GetInstantiate();
            Agency.GetInstantiate();
        }
示例#6
0
        private void Awake()
        {
            MapManager mapManager = MapManager.GetInstantiate();

            for (int i = 0; i < mapManager.ring.GetTiers().Count; i++)
            {
                for (int j = 0; j < mapManager.ring.GetTiers()[i].GetPoints().Count; j++)
                {
                    if (point == mapManager.ring.GetTiers()[i].GetPoints()[j])
                    {
                        point = mapManager.instanceRing.GetTiers()[i].GetPoints()[j];
                        break;
                    }
                }
            }
        }
示例#7
0
        // Use this for initialization

        private void Awake()
        {
            if (shortWay == null)
            {
                GameObject go = new GameObject("ShortWay");
                go.transform.parent = transform;
                shortWay            = go.AddComponent <Way>();
            }
            if (label == null)
            {
                if (transform.Find("Label") != null && transform.Find("Label").GetComponent <SpriteRenderer>())
                {
                    label = transform.Find("Label").GetComponent <SpriteRenderer>();
                }
            }
            GetComponent <SphereCollider>().radius = MapManager.GetInstantiate().pointRadius;
        }
示例#8
0
 private void Update()
 {
     if (changePos)
     {
         MapManager mapManager = MapManager.GetInstantiate();
         timePos += Time.deltaTime;
         Quaternion quaternion = GetComponent <Transform>().rotation;
         float      t          = timePos / mapManager.timePosTier;
         if (t > 1)
         {
             t = 1;
         }
         GetComponent <Transform>().SetPositionAndRotation(new Vector3(0, Mathf.Lerp(transform.position.y, curPosition, t), 0), quaternion);
         if (t == 1)
         {
             changePos = false;
         }
     }
 }
        private void Start()
        {
            MapManager mapManager = MapManager.GetInstantiate();

            point = potentialPoints[Random.Range(0, potentialPoints.Count)];
            for (int i = 0; i < mapManager.ring.GetTiers().Count; i++)
            {
                for (int j = 0; j < mapManager.ring.GetTiers()[i].GetPoints().Count; j++)
                {
                    if (point == mapManager.ring.GetTiers()[i].GetPoints()[j])
                    {
                        point = mapManager.instanceRing.GetTiers()[i].GetPoints()[j];
                        break;
                    }
                }
            }
            mapManager.SetTier(mapManager.GetTierIndex(point));
            point.pointContainer.Add(this);
        }
示例#10
0
        private void Start()
        {
            MapManager mapManager = MapManager.GetInstantiate();

            for (int i = 0; i < mapManager.ring.GetTiers().Count; i++)
            {
                for (int j = 0; j < mapManager.ring.GetTiers()[i].GetPoints().Count; j++)
                {
                    if (point == mapManager.ring.GetTiers()[i].GetPoints()[j])
                    {
                        point = mapManager.instanceRing.GetTiers()[i].GetPoints()[j];
                        break;
                    }
                }
            }
            mapManager.SetTier(mapManager.GetTierIndex(point));
            point.pointContainer.Add(this);
            //
            CreateLeaseAction();
        }
示例#11
0
 private void LateUpdate()
 {
     if (GetActiveActivity().Count > 0)
     {
         Game             game             = Game.GetInstantiate();
         InterfaceManager interfaceManager = InterfaceManager.GetInstantiate();
         MapManager       mapManager       = MapManager.GetInstantiate();
         label.gameObject.SetActive(true);
         label.transform.LookAt(Camera.main.transform);
         labelTime += Time.deltaTime;
         if (labelTime > mapManager.pointLabelTime)
         {
             curLabelIndex++;
             labelTime = 0;
         }
         if (curLabelIndex >= GetActiveActivity().Count)
         {
             curLabelIndex = 0;
         }
         if (GetActiveActivity()[curLabelIndex] is Office)
         {
             if (mouseover)
             {
                 label.sprite = mapManager.overOfficeSprite;
             }
             else
             {
                 label.sprite = mapManager.officeSprite;
             }
         }
         else if (GetActiveActivity()[curLabelIndex] is DetectiveHome)
         {
             if (mouseover)
             {
                 label.sprite = mapManager.overHomeSprite;
             }
             else
             {
                 label.sprite = mapManager.homeSprite;
             }
         }
         else if (GetActiveActivity()[curLabelIndex] is QuestEvent)
         {
             if (mouseover)
             {
                 label.sprite = mapManager.eventOverSprite;
             }
             else
             {
                 label.sprite = mapManager.eventSprite;
             }
         }
         if (game.GetGameState() == GameState.IN_GAME || game.GetGameState() == GameState.WAIT_ACTIVITY_CHOICE)
         {
             if (mouseover != showRollover)
             {
                 showRollover = mouseover;
                 if (showRollover)
                 {
                     interfaceManager.activitiesRollover.Show(GetActiveActivity(), Camera.main.WorldToScreenPoint(transform.position));
                 }
                 else
                 {
                     interfaceManager.activitiesRollover.Hide();
                 }
             }
         }
         else
         {
             if (mouseover && showRollover)
             {
                 showRollover = false;
                 interfaceManager.activitiesRollover.Hide();
             }
         }
     }
     else
     {
         label.gameObject.SetActive(false);
     }
 }