Exemplo n.º 1
0
 private void ChangeOwnership()
 {
     for (var i = 0; i < scoreTrackers.Count; i++)
     {
         ScoreTracker tracker        = scoreTrackers[i];
         TileVisitor  trackerVisitor = tracker.gameObject.GetComponent <TileVisitor>();
         if (trackerVisitor.CurrentlyVisiting.GetTotalNumberOfVisitors(tagForPoints) > 0)
         {
             foreach (TileVisitor otherOccupant in trackerVisitor.CurrentlyVisiting.GetVisitorsOfTag(tagForPoints))
             {
                 PointsGiver pointsGiver = otherOccupant.gameObject.GetComponent <PointsGiver>();
                 if (pointsGiver != null)
                 {
                     if (pointsGiver.OwnedBy != tracker)
                     {
                         //TODO: Handle line of sight exclusion!
                         pointsGiver.OwnedBy = tracker;
                         animationManager.AddNewTakeOver(tracker, pointsGiver);
                     }
                 }
                 else
                 {
                     Debug.LogError("Gameobject: " + otherOccupant.gameObject.name + " is tagged as " +
                                    tagForPoints +
                                    " but doesn't have a pointsgiver object!");
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
    public IEnumerator PlayTakeOverAnimations()
    {
        foreach (KeyValuePair <ScoreTracker, PointsGiver> entry in takeOvers)
        {
            ScoreTracker tracker     = entry.Key;
            PointsGiver  pointsGiver = entry.Value;
            yield return(StartCoroutine(MoveCameraToPosition(tracker.GetComponent <TileVisitor> ().CurrentlyVisiting.transform.position)));

            yield return(StartCoroutine(ZoomCamera(highlightZoomWidth)));

            tracker.GetComponent <CharacterAnimationController>().ApplyState(StateType.Sticker,
                                                                             pointsGiver.GetComponent <HumanAnimationController>());
            GetComponent <AudioSource> ().PlayOneShot(stickerNoise);
            yield return(new WaitForSeconds(timePerStickerAnim));

            yield return(StartCoroutine(ZoomCamera(defaultCameraWidth)));
        }
        yield return(StartCoroutine(MoveCameraToPosition(defaultCameraPos)));

        takeOvers.Clear();
        objectsToAnimate.Clear();
    }
Exemplo n.º 3
0
 public void AddNewTakeOver(ScoreTracker tracker, PointsGiver target)
 {
     takeOvers.Add(tracker, target);
 }