Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        healthPool         = GetComponent <HealthPool>();
        teamTokenCaptain   = GetComponent <TeamTokenCaptain>();
        healthPool.onDied += checkGameOver;
        //Team Token Captains
        teamCaptains = FindObjectsOfType <TeamTokenCaptain>().ToList();
        //Text Map Name
        txtMapName = gameObject.FindComponent <TMP_Text>();
        MapGenerator mapGenerator = FindObjectOfType <MapGenerator>();

        txtMapName.text = mapGenerator.mapName;
        mapGenerator.onMapNameChanged += (mapName) => txtMapName.text = mapName;
        //Marker
        MapMarker mapMarker = MapMarkerManager.CreateMapMarker(
            PhotonView.Get(gameObject),
            transform.position,
            flagMarkerInfo
            );
        GameObject balloons = Instantiate(flagMarkerBalloonPrefab);

        balloons.transform.parent        = mapMarker.iconSR.transform;
        balloons.transform.localPosition = Vector2.zero;
        balloons.GetComponent <FlagMapMarkerDisplay>().Init(this);
    }
    // Start is called before the first frame update
    void Start()
    {
        instance = this;
        rb2d     = GetComponent <Rigidbody2D>();
        PV       = GetComponent <PhotonView>();
        foreach (TeamTokenCaptain ttc in FindObjectsOfType <TeamTokenCaptain>())
        {
            teamCaptains.Add(ttc, 0);
        }
        updateDirection(PV.IsMine);
        contestEffect.enabled             = false;
        pathGenerator.onMapPathGenerated += updatePositionOnPath;
        if (pathGenerator.mapPath != null)
        {
            updatePositionOnPath(pathGenerator.mapPath);
        }
        //Display for on the caravan
        gameObject.FindComponent <CaravanMapMarkerDisplay>()?.Init(this);
        //Marker
        MapMarker mapMarker = MapMarkerManager.CreateMapMarker(
            PV,
            transform,
            caravanMarkerInfo
            );
        GameObject balloons = Instantiate(caravanMarkerBalloonPrefab);

        balloons.transform.parent        = mapMarker.iconSR.transform;
        balloons.transform.localPosition = Vector2.zero;
        balloons.GetComponent <CaravanMapMarkerDisplay>().Init(this);
    }
 void trapPlayer(PlayerController playerController)
 {
     playerController.statusKeeper.addLayer(
         PV.ViewID,
         new StatusLayer(StatusEffect.ROOTED)
         );
     trappedPlayer = playerController;
     trappedPlayer.playerMovement.rb2d.transform.position = transform.position;
     //Map marker
     MapMarkerManager.CreateMapMarker(
         PV,
         (Vector2)transform.position + (Vector2.up * 0.5f),
         trapMarkerInfo
         );
     TimerManager.StartTimer(trapDuration, () =>
     {
         //untrap player
         trappedPlayer.statusKeeper.removeLayer(PV.ViewID);
         //destroy trap
         if (PV.IsMine)
         {
             health.Health = 0;
         }
         //Make it disappear even if it doesn't actually get destroyed
         gameObject.FindComponent <SpriteRenderer>().enabled = false;
         gameObject.FindComponent <Collider2D>().enabled     = false;
         this.enabled = false;
         //Destroy marker
         MapMarkerManager.DestroyMapMarker(PV);
     });
 }
Beispiel #4
0
 private void Awake()
 {
     instance = this;
 }