示例#1
0
    public bool init()
    {
        //GameObject.FindGameObjectWithTag("Logic").GetComponent<PhaseManager>().readJSON();
        _tileSelectedPosition = new uint[2] {
            28, 25
        };
        _hasTileSelected = false;
        m_monthsInRed    = 0;
        m_monthsSinceIShowedInRedPopup = 0;
        b_warningInRedPopupShown       = false;
        //_terrainLogic = new RiceTerrainLogic();
        ActionManager.GetInstance();
        CoopManager.GetInstance();
        PenalizationManager.GetInstance();
        WorldTerrain.GetInstance().initWorld();
        BuildingsManager.GetInstance().init();
        UserDataManager.GetInstance().init();
        UserDataManager.GetInstance().gold.setGold(6800);
        RiceObjectsManager.GetInstance();
        _cloudSpawner = new CloudSpawner(WorldTerrain.CLOUDS_Z_LAYER);

        _tutMan.startTuto(new Tutorial_Inicial());
        GameSaveDataManager.init();

        return(true);
    }
示例#2
0
        public void Init(CloudSpawner cloudSpawner)
        {
            spawner = cloudSpawner;

            Xmax = spawner.GetXMax();

            cloudRenderer = GetComponent <SpriteRenderer>();
        }
示例#3
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     SetMinAndMaxX();
     distanceBetweenObstacles = 2.7f;
     CreateObstacles();
 }
示例#4
0
 public Cloud(GameObject instance, CloudSpawner parent, uint id, double endPoint)
 {
     _instance        = instance;
     m_imgWidth       = _instance.GetComponent <SpriteRenderer>().sprite.rect.width;
     m_imgWidth       = m_imgWidth / _instance.GetComponent <SpriteRenderer>().sprite.pixelsPerUnit;
     _parent          = parent;
     _id              = id;
     _speedMultiplier = 1.0f;
     m_endPoint       = endPoint;
 }
 // Use this for initialization
 void Start()
 {
     bloomSettings = profile.bloom.settings;
     bloomSettings.bloom.softKnee = 0.5f;
     bloomSettings.bloom.radius   = 4;
     StartCoroutine(blendToSkybox(skyboxToBlendIn));
     if (!spawner)
     {
         spawner = GameObject.Find("Cloud Spawner").GetComponent <CloudSpawner>();
     }
 }
示例#6
0
    public override void OnInspectorGUI()
    {
        CloudSpawner cloudSpawner = (CloudSpawner)target;

        if (GUILayout.Button("Spawn Cloud"))
        {
            cloudSpawner.SpawnCloud(true);
        }

        EditorGUILayout.Space(10);
        DrawDefaultInspector();
    }
示例#7
0
    void ActivateGameBehaviours()
    {
        EnemySpawner[] enemySpawners = GameObject.FindObjectsOfType(typeof(EnemySpawner)) as EnemySpawner[];
        CloudSpawner   cloudSpawner  = GameObject.FindObjectOfType(typeof(CloudSpawner)) as CloudSpawner;
        GUIText        guiText       = GameObject.Find("Score").GetComponent <GUIText>() as GUIText;
        CamShake       camShake      = GameObject.FindObjectOfType(typeof(CamShake)) as CamShake;

        enemySpawners [0].enabled = true;
        enemySpawners [1].enabled = true;
        cloudSpawner.enabled      = true;
        guiText.enabled           = true;
        camShake.enabled          = true;
    }
示例#8
0
    void AttemptSpawn(IntRect rect, EnemySpawnSettings.EnemySpawn spawn)
    {
        if (_coordsList == null)
        {
            _coordsList = new List <SpawnCoords>();
        }
        _coordsList.Clear();
        IntRect windowRect = CloudSpawner.GetCurrentRect(LayerDepth, GridSize, new Vector2(0.6f, 0.6f));

        int minY = rect.MinY;

        if (spawn.HasMinY)
        {
            minY = Mathf.Max(minY, spawn.MinY);
        }
        int maxY = rect.MaxY;

        if (spawn.HasMaxY)
        {
            maxY = Mathf.Min(maxY, spawn.MaxY + 1);
        }
        for (int x = rect.MinX; x < rect.MaxX; x++)
        {
            for (int y = minY; y < maxY; y++)
            {
                if (x > windowRect.MinX &&
                    x < windowRect.MaxX - 1 &&
                    y > windowRect.MinY &&
                    y < windowRect.MaxY - 1)
                {
                    continue;
                }
                if (IsSpawnValid(spawn, x, y) == false)
                {
                    continue;
                }
                _coordsList.Add(new SpawnCoords()
                {
                    X = x,
                    Y = y,
                });
            }
        }

        if (_coordsList.Count > 0)
        {
            var coord = _coordsList[Random.Range(0, _coordsList.Count)];
            SpawnEnemy(spawn, coord);
        }
    }
示例#9
0
    void Update()
    {
        if (_firstEnemyKilled)
        {
            _timer += Time.deltaTime;
        }

        IntRect currentRect = CloudSpawner.GetCurrentRect(LayerDepth, GridSize, MaxSpawnRectModifier);

        float periodT;
        var   spawnSettings = GetCurrentSpawnSettings(_timer, out periodT);

        if (_firstEnemyKilled)
        {
            _SpawnAccumulator += spawnSettings.SpawnSpeed * spawnSettings.IntensityCurve.Evaluate(periodT) * Time.deltaTime;
        }

        if (_SpawnAccumulator >= 0)
        {
            float totalSpawnChance = 0;
            for (int i = 0; i < spawnSettings.Spawns.Length; i++)
            {
                var spawn = spawnSettings.Spawns[i];
                if (IsValidSpawn(currentRect, spawn, _timer))
                {
                    totalSpawnChance += spawn.SpawnChance;
                }
            }

            float randomVal = Random.Range(0, totalSpawnChance);

            for (int i = 0; i < spawnSettings.Spawns.Length; i++)
            {
                var spawn = spawnSettings.Spawns[i];
                if (IsValidSpawn(currentRect, spawn, _timer))
                {
                    if (spawn.SpawnChance > randomVal)
                    {
                        AttemptSpawn(currentRect, spawn);
                        break;
                    }
                    randomVal -= spawn.SpawnChance;
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        ProceduralWorldCreator worldCreator = GetComponent <ProceduralWorldCreator>();
        CloudSpawner           cloudSpawner = GetComponent <CloudSpawner>();
        MountainSpawner        spawner      = GetComponent <MountainSpawner>();

        LevelParameters level = levels[levelNumber];

        worldCreator.minNumContinents = level.minNumContinents;
        worldCreator.maxNumContinents = level.maxNumContinents;
        cloudSpawner.minCloudCount    = level.minNumClouds;
        cloudSpawner.maxCloudCount    = level.maxNumClouds;
        spawner.minSpawnTime          = level.minMountainSpawnRate;
        spawner.maxSpawnTime          = level.maxMountainSpawnRate;

        numLevels = 3; //levels.Length;
    }
示例#11
0
 public void load(LogicManagerData logicManagerData)
 {
     _tileSelectedPosition = new uint[2] {
         26, 15
     };
     _hasTileSelected = false;
     ActionManager.GetInstance();
     CoopManager.GetInstance();
     PenalizationManager.GetInstance();
     //WorldTerrain.GetInstance().initWorld();
     //BuildingsManager.GetInstance().init();
     UserDataManager.GetInstance().init();
     RiceObjectsManager.GetInstance();
     _cloudSpawner = new CloudSpawner(WorldTerrain.CLOUDS_Z_LAYER);
     gameObject.GetComponent <TimeManager>().addListenerToYearChange(this.happyNewYear);
     gameObject.GetComponent <TimeManager>().addListenerToMonthChange(happyNewMonth);
     gameObject.GetComponent <TimeManager>().addListerToDayChange(this.newDayCallback);
 }
示例#12
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     _screenW     = (int)GetViewport().Size.x;
     _screenH     = (int)GetViewport().Size.y;
     TileMapTrack = (TileMap)GetNode("TileMapTrack");
     TileMapDecor = (TileMap)GetNode("TileMapDecoration");
     pt           = (Timer)GetNode("PlayTimer");
     pt.Connect("timeout", this, "_OnPlayTimerTimeout");
     SetTiles();
     cam       = (Camera2D)GetNode("PlayerCar/Camera2D");
     PlayerCar = (PlayerCar)GetNode("PlayerCar");
     PlayerCar.Set("Map", TileMapTrack);
     PlayerCar.Position = new Vector2(_screenW / 2, -2000);// _screenH / 2 - 400);
     _mapstartTime      = OS.GetTicksMsec();
     cloudSpawner       = (CloudSpawner)GetNode("CloudSpawner");
     cloudSpawner.SetupSpawner(_screenW, _screenH, PlayerCar);
     SetupAISpawner();
 }
示例#13
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        // GameObject player = GameObject.FindWithTag ("Player");
        // playerController = player.GetComponent<PlayerController> ();
        cloudSpawner = GetComponentInChildren <CloudSpawner> ();
        GameObject water = GameObject.FindWithTag("Water");

        waterController = water.GetComponent <WaterController>();

        obstacleGenerator = GetComponentInChildren <ObstacleGenerator>();
        obstacleGenerator.GenerateObstacles(70f);
    }
示例#14
0
    protected virtual void FixedUpdate()
    {
        _rb.position += Direction * MovementSpeed * Time.deltaTime;
        bool anythingVisible = false;

        for (int i = 0; i < _Renderers.Length; i++)
        {
            if (_Renderers[i].isVisible)
            {
                anythingVisible = true;
                break;
            }
        }

        if (anythingVisible)
        {
            _LastVisibleTime = Time.time;
        }
        else
        {
            Vector3 pos = transform.position;
            Vector2 centerPos;
            Vector2 frustumSize = CloudSpawner.GetFrustumSize(pos.z, out centerPos);

            float distance = Vector2.Distance(pos, Blokfosk.Instance.transform.position);
            if (_LastVisibleTime + 5f < Time.time || distance > frustumSize.x * 2.5f)
            {
                var explode = GetComponent <Explodable>();
                if (explode)
                {
                    explode.Spawner.ReturnSpawnValue(FromPrefab);
                    explode.Spawner.Despawn(gameObject);
                }
            }
        }
    }