Beispiel #1
0
    // Load actorA saved game
    public void Load()
    {
        print("Loading...");
        StorageHandler sh = new StorageHandler();
        PlayerData     dp = (PlayerData)sh.LoadData("player") as PlayerData;

        _pd = dp;
        PlayerDataTracker pdt = PlayerDataTracker.GetInstance();

        pdt.Dt       = _pd;
        PlayerPrefab = Instantiate(PlayerPrefab, new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY(), pdt.GetPlayerZ()), Quaternion.identity);

        PlayerPrefab.gameObject.name = "Player";
        this.gameObject.GetComponent <EnvironmentColours>().Player = PlayerPrefab;

        C.transform.position = new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY() + 10, pdt.GetPlayerZ());
        C.transform.parent   = PlayerPrefab.transform;

        _dta                   = TempDataTracker.GetInstance();
        _settingsReader        = SettingsReader.GetInstance();
        _cam                   = GameObject.Find("Main Camera");
        _environmentController = EnvironmentController.GetInstance();
        _gm = GeneticsManager.GetInstance();
        _co = CollisionMediator.GetInstance();
        _am = AudioManager.GetInstance();
    }
Beispiel #2
0
        public void CreateEnemies()
        {
            foreach (var pair in EnemyCounts.EnemyCountTuples)
            {
                var chromosomeList = GeneticsManager.GetChromosomesForEnemyType(pair.Item2, pair.Item1);

                for (var i = 0; i < pair.Item1; i++)
                {
                    CreatedEnemies.Add(EnemyFactories.CreateNew(pair.Item2, chromosomeList[i]));
                }
            }
        }
Beispiel #3
0
    public static GeneticsManager GetInstance()
    {
        if (Instance)
        {
            return(Instance);
        }
        Container = new GameObject {
            name = "GeneticsManager"
        };
        Instance = Container.AddComponent <GeneticsManager>();

        return(Instance);
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        gm    = GameObject.Find("GeneticsManager").GetComponent <GeneticsManager>();
        start = this.transform;
        float RandScale = Random.Range(1f, 14.57f);

        half1            = transform.GetChild(0);
        half2            = transform.GetChild(1);
        center           = transform.GetChild(2);
        half2.localScale = new Vector3(1, RandScale, 1);
        half1.localScale = new Vector3(1, 15.57f - RandScale, 1);
        center.position  = new Vector3(half2.transform.position.x, half2.position.y - (0.5f * half2.localScale.y) - 2, 0);
    }
Beispiel #5
0
    void Awake()
    {
        _fadeScr = GameObject.FindObjectOfType <ScreenFader>();
        // Create actorA temporary reference to the current scene.
        Scene currentScene = SceneManager.GetActiveScene();

        _sceneName = currentScene.name;
        _sc        = GameObject.Find("UI Controller").GetComponent <GameStatusManager>();
        print("-------- " + _sc.GameStatus.ToString());

        _dta                   = TempDataTracker.GetInstance();
        _settingsReader        = SettingsReader.GetInstance();
        _cam                   = GameObject.Find("Main Camera");
        _environmentController = EnvironmentController.GetInstance();
        _gm = GeneticsManager.GetInstance();
        _co = CollisionMediator.GetInstance();
    }
Beispiel #6
0
        public void SetGenetics(SerializableChromosome chromosome = null)
        {
            Chromosome = chromosome ?? GeneticsManager.GenerateNewChromsome();

            var baseAttributes      = GetBaseAttributes();
            var effectiveAttributes = GetGeneticAttributes(baseAttributes, Chromosome);

            MaximumHealth   = effectiveAttributes.MaximumHealth;
            HealthRemaining = MaximumHealth;

            EffectiveSpeed = effectiveAttributes.EffectiveSpeed;

            EffectivePiercingResist = effectiveAttributes.EffectivePiercingResist;
            EffectiveBombardResist  = effectiveAttributes.EffectiveBombardResist;
            EffectiveChemicalResist = effectiveAttributes.EffectiveChemicalResist;
            EffectiveFireResist     = effectiveAttributes.EffectiveFireResist;
            EffectiveFrostResist    = effectiveAttributes.EffectiveFrostResist;
            EffectiveElectricResist = effectiveAttributes.EffectiveElectricResist;
        }
Beispiel #7
0
    private void Awake()
    {
        _fadeScr = GameObject.FindObjectOfType <ScreenFader>();
        // Create actorA temporary reference to the current scene.
        Scene currentScene = SceneManager.GetActiveScene();

        _sceneName = currentScene.name;
        _sc        = GameObject.Find("UI Controller").GetComponent <GameStatusManager>();
        print("-------- " + _sc.GameStatus.ToString());

        if (_sc.GameStatus == 4)
        {
            print("First start...");
            _dta                   = TempDataTracker.GetInstance();
            _settingsReader        = SettingsReader.GetInstance();
            _cam                   = GameObject.Find("Main Camera");
            _environmentController = EnvironmentController.GetInstance();
            _gm = GeneticsManager.GetInstance();
            _co = CollisionMediator.GetInstance();
            _am = AudioManager.GetInstance();
            PlayerDataTracker pdt = PlayerDataTracker.GetInstance();
            _pd = pdt.Dt;

            var s = _settingsReader.FoodWideSpreadY;
            _defaultN = s;

            PlayerPrefab = Instantiate(PlayerPrefab, new Vector3(0, s, 0), Quaternion.identity);
            PlayerPrefab.gameObject.name = "Player";

            pdt.SetEnergy(_settingsReader.PlayerStartEnergy);

            this.gameObject.GetComponent <EnvironmentColours>().Player = PlayerPrefab;
        }
        else if (_sc.GameStatus == 3)
        {
            Load();
        }

        C = Camera.main;
        C.transform.position = new Vector3(PlayerPrefab.transform.position.x, PlayerPrefab.transform.position.y + 10, PlayerPrefab.transform.position.z);
        C.transform.parent   = PlayerPrefab.transform;
    }
    private void Awake()
    {
        _fadeScr = GameObject.FindObjectOfType <ScreenFader>();

        // Create actorA temporary reference to the current scene.
        Scene currentScene = SceneManager.GetActiveScene();

        _sceneName = currentScene.name;

        _d = TempDataTracker.GetInstance();
        _settingsReader        = SettingsReader.GetInstance();
        _cam                   = GameObject.Find("Main Camera");
        _environmentController = EnvironmentController.GetInstance();
        _gm = GeneticsManager.GetInstance();
        _co = CollisionMediator.GetInstance();
        _am = AudioManager.GetInstance();

        C = Camera.main;
        C.transform.parent = PlayerPrefab.transform;
    }
Beispiel #9
0
 // Use this for initialization
 void Start()
 {
     gm = GameObject.Find("GeneticsManager").GetComponent <GeneticsManager>();
     InvokeRepeating("CreatePipe", 0.0f, 1.0f);
 }