예제 #1
0
    private void Start()
    {
        _settingsReader = SettingsReader.GetInstance();
        _environment    = EnvironmentController.GetInstance();

        VariablesInit();
    }
예제 #2
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();
    }
 // Update is called once per frame
 void Update()
 {
     transform.position += direction * Time.deltaTime * randomSpeed;
     if (transform.position.z > limitBound.z)
     {
         EnvironmentController.GetInstance().RemoveObject(this);
     }
 }
예제 #4
0
    private void Start()
    {
        // Build references
        CollisionEventsStorer = new ArrayList();
        EnvironmentController = EnvironmentController.GetInstance();
        AudioManager          = AudioManager.GetInstance();
        _settings             = SettingsReader.GetInstance();

        // Read settings variables
        _energyPassage  = _settings.CreatureEnergyToOffspring;
        _crossoverRate  = (double)_settings.GeneticsCrossoverRate;
        _mutationRate   = (double)_settings.GeneticsMutationRate;
        _mutationFactor = _settings.GeneticsMutationFactor;
    }
예제 #5
0
    private void Awake()
    {
        _environment = EnvironmentController.GetInstance();

        _pt = PlayerDataTracker.GetInstance();
        _pc = GetComponent <ControllerSetup>();
        // create list of limbs
        var t = transform;

        foreach (Transform child in t)
        {
            if (child.gameObject.name.Contains("limb_"))
            {
                Limbs.Add(child.gameObject.transform);
                if (child.gameObject.name.Contains("limb_0"))
                {
                    Limbs0.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_1"))
                {
                    Limbs1.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_2"))
                {
                    Limbs2.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_3"))
                {
                    Limbs3.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_4"))
                {
                    Limbs4.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_5"))
                {
                    Limbs5.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_6"))
                {
                    Limbs6.Add(child.gameObject.transform);
                }
                if (child.gameObject.name.Contains("limb_7"))
                {
                    Limbs7.Add(child.gameObject.transform);
                }
            }
        }
    }
예제 #6
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();
    }
예제 #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;
    }
예제 #8
0
    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;
    }
예제 #9
0
    private void Start()
    {
        _changeDist = transform.position.y;

        _player = GameObject.FindGameObjectWithTag("Player");

        name = "food";
        SettingsReader.GetInstance();

        _environment = EnvironmentController.GetInstance();

        _mr = GetComponent <MeshRenderer>();
        _mr.sharedMaterial = (Material)Resources.Load("Materials/food");

        Collider co = GetComponent <SphereCollider>();

        co.isTrigger = true;

        Random.Range(-1.0f, 1.0f);
        gameObject.AddComponent <AudioSource>();
    }
 private void Start()
 {
     _environment  = EnvironmentController.GetInstance();
     FoodAvailable = new List <int>();
 }
예제 #11
0
    private void Start()
    {
        var foodPreference = Random.Range(0, 100);

        if (foodPreference >= 0 && foodPreference < 30)
        {
            TypeOfCreature = "Carnivorous";
        }
        if (foodPreference >= 30 && foodPreference <= 100)
        {
            TypeOfCreature = "Herbiverous";
        }

        _t = transform; // default transform of creature (parent)
        //name = "creature" + gameObject.GetInstanceID(); // name of creature (planning on randomising this)

        _t.gameObject.layer = LayerMask.NameToLayer("Creature");

        _environment    = EnvironmentController.GetInstance();
        _settingsReader = SettingsReader.GetInstance();

        // everything from here is to do with the transforms of the creature and its limbs
        _maxRootScale = new Vector3
        {
            x = _settingsReader.RootMaxRootScaleX,
            y = _settingsReader.RootMaxRootScaleY,
            z = _settingsReader.RootMaxRootScaleZ
        };

        _minRootScale = new Vector3
        {
            x = _settingsReader.RootMinRootScaleX,
            y = _settingsReader.RootMinRootScaleY,
            z = _settingsReader.RootMinRootScaleZ
        };

        _jointFrequency = ChromosomeComposition.JointFrequency;
        _jointAmplitude = ChromosomeComposition.JointAmplitude;
        _jointPhase     = ChromosomeComposition.JointPhase;

        RootSetup();

        EyeSetup();

        MouthSetup();

        GenitalSetup();

        VariableSetup();

        InvokeRepeating("UpdateState", 0, 5f);      // update state every 5 seconds
        InvokeRepeating("RandomDirection", 1F, 5F); // update direction every 5 seconds

        Root.GetComponent <Rigidbody>().SetDensity(4F);
        Root.AddComponent <AudioSource>();
        _ms = GetComponentsInChildren <MeshRenderer>();
        ChromosomeComposition.SetTypeOfCreature(TypeOfCreature);
        // setup a name
        name = NameCreator.Name(ChromosomeComposition);
        NameSetup();
    }
 // Use this for initialization
 public override void Start()
 {
     base.Start();
     limitBound = EnvironmentController.GetInstance().maxBounds;
     direction  = new Vector3(Random.Range(0.1f, 1f), Random.Range(0.1f, 1f), Random.Range(0.1f, 1f));
 }
예제 #13
0
 private void Start()
 {
     _eth = EnvironmentController.GetInstance();
 }
예제 #14
0
 private void Start()
 {
     TempDataTracker.GetInstance();
     EnvironmentController.GetInstance();
     CrtCounterObservor = CreatureCounterObservor.GetInstance();
 }