void Start()
    {
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;

        playerManager = managerStore.Get <PlayerManager>();
        scoreManager  = managerStore.Get <ScoreManager>();
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;
        StateManager stateManager = managerStore.Get <StateManager>();

        stateManager.AddListener(this);
        scoreManager = managerStore.Get <ScoreManager>();
    }
Beispiel #3
0
    public override bool Link()
    {
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;

        spawnManager  = managerStore.Get <SpawnManager>();
        playerManager = managerStore.Get <PlayerManager>();

        return(true);
    }
    public override bool Link()
    {
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;
        StateManager stateManager = managerStore.Get <StateManager>();

        stateManager.AddListener(this);

        highscoreManager = managerStore.Get <HighscoreManager>();

        return(base.Link());
    }
Beispiel #5
0
    public override bool Link()
    {
        // Fetch the spawn manager
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;

        spawnManager = managerStore.Get <SpawnManager>();
        StateManager stateManager = managerStore.Get <StateManager>();

        stateManager.AddListener(this);

        return(true);
    }
Beispiel #6
0
    //private void OnDespawn(object sender, SpawnArgs e)
    //{
    //    // Remove the spawnable and unregister from it
    //    activeList.Remove(e.Spawnable);
    //    e.Spawnable.OnDespawn -= OnDespawn;
    //}

    public bool GetNextEnemy(out Spawnable enemy)
    {
        if (spawnQueue.Count > 0) // Is there something to spawn?
        {
            string entry = spawnQueue.Dequeue();

            // Fetch the spawn manager
            Main         main         = Main.Instance;
            ManagerStore managerStore = main.ManagerStore;
            SpawnManager spawnManager = managerStore.Get <SpawnManager>();

            // Try to spawn the enemy
            if (spawnManager.Spawn(entry, out enemy))
            {
                // Register to the spawnables despawn
                //enemy.OnDespawn += OnDespawn;
                //activeList.Add(enemy);
                return(true);
            }
            else // Enemy isn't valid
            {
                Debug.LogError("Wave manager unable to spawn " + entry + " because it's an invalid spawnable");
                return(false);
            }
        }
        else // Nothing to spawn
        {
            enemy = null;
            return(false);
        }
    }
Beispiel #7
0
    public void OnFinishedLink(Main main)
    {
        // Self-register for state updates
        ManagerStore managerStore = main.ManagerStore;
        StateManager stateManager = managerStore.Get <StateManager>();

        stateManager.AddListener(this);
    }
    private void Start()
    {
        Main             main             = Main.Instance;
        ManagerStore     managerStore     = main.ManagerStore;
        HighscoreManager highscoreManager = managerStore.Get <HighscoreManager>();

        highscoreManager.AddListener(this);
    }
    private void Transition(GameState state)
    {
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;
        StateManager stateManager = managerStore.Get <StateManager>();

        stateManager.SetState(state);
    }
Beispiel #10
0
    // Update is called once per frame
    void Update()
    {
        Main         main          = Main.Instance;
        ManagerStore managerstore  = main.ManagerStore;
        ScoreManager playermanager = managerstore.Get <ScoreManager>();

        currentScore = playermanager.Score;


        scoreText.text = currentScore.ToString();
    }
    private void Die()
    {
        alive = false;

        // Fetch the spawn manager
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;
        SpawnManager spawnManager = managerStore.Get <SpawnManager>();

        // Store the enemy
        spawnManager.Store(spawnable);
    }
    private void Update()
    {
        Main          main          = Main.Instance;
        ManagerStore  managerstore  = main.ManagerStore;
        PlayerManager playermanager = managerstore.Get <PlayerManager>();
        Health        hitpoint      = playermanager.Health;

        currenthitpoint = (hitpoint.CurrentHealth / hitpoint.MaxHealth);

        currentHealthBar.rectTransform.localScale = new Vector3(currenthitpoint, 1, 1);
        ratioText.text = (currenthitpoint * 100).ToString() + "%";
    }
Beispiel #13
0
    public void Kill()
    {
        target.SendMessage("OnCargoDetached", this, SendMessageOptions.DontRequireReceiver);
        target.SendMessage("ToggleOn", SendMessageOptions.DontRequireReceiver);

        time          = 0.0f;
        falling       = false;
        target.parent = null;
        target        = null;

        particles.Stop();

        // Fetch the spawn manager
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;
        PodManager   podManager   = managerStore.Get <PodManager>();

        podManager.CleanPod(this);
    }
Beispiel #14
0
    public void Cleanup()
    {
        // Fetch the spawn manager
        Main         main         = Main.Instance;
        ManagerStore managerStore = main.ManagerStore;
        SpawnManager spawnManager = managerStore.Get <SpawnManager>();

        // Iterate and despawn all objects
        //int count = activeList.Count;
        //for(int i = 0; i < activeList.Count; i++)
        //{
        //    Spawnable spawnable = activeList[0];
        //    Despawn(spawnManager, spawnable);
        //}

        //Debug.Log("Cleaned up " + count);

        //foreach(Spawnable instance in activeList)
        //{
        //    Despawn(spawnManager, instance);
        //}
    }