Esempio n. 1
0
    void Start()
    {
        var mapGenerator = GetComponent <MapGenerator>();

        blockRenderer    = GetComponent <BlockRenderer>();
        stats            = GetComponent <PlayerStatistics>();
        spawnSerializer  = GetComponent <SpawnSerializer>();
        canvasController = GetComponent <GameCanvasController>();
        sounds           = GetComponent <SoundController>();
        map = mapGenerator.Generate(90, 90);

        Func <Spawn, VectorI2> GetStart = (s) =>
        {
            int        rndId = UnityEngine.Random.Range(0, s.spawnPoints.Count);
            SpawnPoint sp    = s.spawnPoints[rndId];

            var vec = new VectorI2((int)sp.playerSpawn.x, (int)sp.playerSpawn.y);
            map[vec.X, vec.Y] = Constants.Objects.Floor;

            var vecRadio = new VectorI2((int)sp.radioSpawn.x, (int)sp.radioSpawn.y);
            map[vecRadio.X, vecRadio.Y] = Constants.Objects.Radio;

            return(vec);
        };

        playerPos = GetStart(spawnSerializer.GetSpawn());

        blockRenderer.Initialize(SquareIsValid, map, playerPos.X, playerPos.Y);

        StartCoroutine(ReduceOxygen());
        StartCoroutine(RunDownRadio());
    }
Esempio n. 2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 3
0
 private void Awake()
 {
     if (sInstance != null && sInstance != this)
     {
         Destroy(sInstance);
     }
     sInstance = this;
 }
Esempio n. 4
0
        public LevelState(PreparedLevel preparedLevel, GameManager gameManager)
        {
            receivedPreparedLevel = preparedLevel;
            levelObjectInstance   = preparedLevel.PreparedLevelGOInstance.GetComponent <LevelObject>();

            this.gameManager     = gameManager;
            cameraManager        = gameManager.cameraManager;
            ballThrowableManager = gameManager.ballThrowableManager;
            GameCanvasController = gameManager.gameCanvasController;
        }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     if (GCC == null)
     {
         GCC = this;
     }
     else
     {
         Destroy(this);
     }
     timeManager = TimeManager.Instance;
 }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        float rotrange = MaxAngle - MinAngle;
        float rpm      = (c.player.v.RPM / MaxRPM);

        float changeRate = (Mathf.Clamp(c.player.v.RPM, 0, 7000) - oldrpm) / Time.deltaTime;

        oldrpm = Mathf.Clamp(c.player.v.RPM, 0, 7000);

        ChangeRate = Mathf.Lerp(ChangeRate, changeRate, Time.deltaTime * 10f);

        if (invert)
        {
            rpm = 1 - rpm;
        }
        rpm = Mathf.Clamp01(rpm);
        transform.rotation = Quaternion.Euler(0, 0, rpm * rotrange + MinAngle);

        float blurval = 0;

        if (Mathf.Abs(ChangeRate) > 1600)
        {
            blurval = (Mathf.Abs(ChangeRate) - 1600) / 8000;
        }
        blurval = Mathf.Abs(blurval);
        for (int i = 0; i < BlurP.Length; i++)
        {
            BlurP[i].rectTransform.localRotation = Quaternion.Euler(0, 0, blurval * (i + 1 / (float)BlurP.Length));
            BlurN[i].rectTransform.localRotation = Quaternion.Euler(0, 0, -blurval * (i + 1 / (float)BlurP.Length));
            Color c = new Color(1, 1, 1, (1 - (i / (float)BlurP.Length)) / (blurval * 16));
            if (rpm < 0.25f)
            {
                c = new Color(1, 0, 0, (1 - (i / (float)BlurP.Length)) / (blurval * 16));
            }
            BlurP[i].color = c;
            BlurN[i].color = c;
        }

        GetComponent <Image>().color = new Color(1, 1, 1, 1 / (blurval * 48));
        if (rpm < 0.25f)
        {
            GetComponent <Image>().color = new Color(1, 0, 0, 1 / (blurval * 48));
        }
    }
Esempio n. 7
0
        private void Awake()
        {
            gameCanvasController     = GameCanvas.GetComponent <GameCanvasController>();
            gameOverCanvasController = GameOverCanvas.GetComponent <GameOverCanvasController>();

            dictionary = new Dictionary <GameObject, List <GameMode.eMode> >()
            {
                { TitleCanvas, new List <GameMode.eMode>()
                  {
                      GameMode.eMode.Title
                  } },
                { GameCanvas, new List <GameMode.eMode>()
                  {
                      GameMode.eMode.Game, GameMode.eMode.Tutorial, GameMode.eMode.Pause
                  } },
                { GameOverCanvas, new List <GameMode.eMode>()
                  {
                      GameMode.eMode.GameOver, GameMode.eMode.Credits
                  } },
            };
        }
Esempio n. 8
0
    /// <summary>
    /// Used to initialise the singleton World object
    /// </summary>
    internal void Awaken()
    {
        if (Instance != null)
        {
            return;
        }

        Instance = this;

        _kernel = Flow.Create.NewKernel();

        _player = FindObjectOfType <Player>();

        GameCanvas = FindObjectOfType <GameCanvasController>();

        _gateManager = FindObjectOfType <GateManager>();

        _game = FindObjectOfType <Game>();

        // TODO: combine scenes
        _loaded = true;

        ActivateGame(false);
    }
Esempio n. 9
0
 void Start()
 {
     instance = this;
 }
Esempio n. 10
0
 // Start is called before the first frame update
 void Start()
 {
     c    = GetComponentInParent <GameCanvasController>();
     text = GetComponentInChildren <Text>();
 }
Esempio n. 11
0
 void Awake()
 {
     Instance = this;
     gameObject.SetActive(true);
 }
Esempio n. 12
0
 // Start is called before the first frame update
 void Start()
 {
     text = GetComponent <Text>();
     c    = GetComponentInParent <GameCanvasController>();
     v    = c.player.v;
 }
Esempio n. 13
0
 public void OnBossSpawned()
 {
     GameCanvasController.GetInstance().OnBossAppeared();
 }
Esempio n. 14
0
    private IEnumerator VictoryAfterDelay()
    {
        yield return(new WaitForSeconds(1f));

        GameCanvasController.GetInstance().OnVictory();
    }
Esempio n. 15
0
 void Start()
 {
     c      = GetComponentInParent <GameCanvasController>();
     oldrpm = c.player.v.RPM;
 }
Esempio n. 16
0
    /// <summary>
    /// Used to initialise the singleton World object
    /// </summary>
    internal void Awaken()
    {
        if (Instance != null)
            return;

        Instance = this;

        _kernel = Flow.Create.NewKernel();

        _player = FindObjectOfType<Player>();

        GameCanvas = FindObjectOfType<GameCanvasController>();

        _gateManager = FindObjectOfType<GateManager>();

        _game = FindObjectOfType<Game>();

        // TODO: combine scenes
        _loaded = true;

        ActivateGame(false);
    }