Exemple #1
0
        private void Awake()
        {
            InjectDependencies("InjectDeathCircleController");
            timeWait = deathCircleValues.WaitTimeInSecond[(int)currentPhase];

            safeCircle  = GetAllChildrens()[0].GetComponent <LineRendererCircle>();
            deathCircle = GetAllChildrens()[1].GetComponent <LineRendererCircle>();

            playerMoveEventChannel.OnEventPublished += OnPlayerMove;

            Vector2 tiledMapScaled = new Vector2((float)tiledMap.MapWidthInPixels / tiledMap.TileWidth,
                                                 (float)tiledMap.MapHeightInPixels / tiledMap.TileHeight);

            transform.position = new Vector3(tiledMapScaled.x / 2f, 90, -tiledMapScaled.y / 2f);
            float mapDiagonalRadius = Mathf.Sqrt((tiledMapScaled.x * tiledMapScaled.x) + (tiledMapScaled.y * tiledMapScaled.y) / 2);

            CreateCircle(ref safeCircle, mapDiagonalRadius);
            CreateCircle(ref deathCircle, mapDiagonalRadius);

            center = deathCircle.transform.position;
        }
Exemple #2
0
 private void CreateCircle(ref LineRendererCircle lineRendererCircle, float radius)
 {
     lineRendererCircle.Radius = radius;
     lineRendererCircle.Create();
 }