Esempio n. 1
0
    private void Start()
    {
        waves       = GameObject.Find("Waves").GetComponent <WaterPlane>();
        waterShader = waves.material;


        micObject      = GameObject.Find("Microphone");
        gyroObject     = GameObject.Find("Gyroscope");
        windController = GameObject.Find("Wind").GetComponent <WindController>();

        lightSensor = GameObject.Find("LightSensor").GetComponent <LightSensorInput>();

        deployClouds = GameObject.Find("CloudManager").GetComponent <Deploy_Clouds>();


        perl = transform.FindChild("black_perl");

        boat               = GetComponent <Rigidbody>();
        direction          = new Vector3();
        development        = false;
        transform.rotation = Quaternion.identity; //for some reason the boat spawns sideways...
        boatCamera         = Camera.main.GetComponent <SmoothFollow>();
        cameraDistanceInit = boatCamera.distance;

        cloudTransform             = transform.FindChild("Cloud");
        cloudSystem                = cloudTransform.GetComponent <ParticleSystem>();
        cloudSystem.enableEmission = false;


        //windZone = transform.FindChild("WindZone").GetComponent<WindZone>();

        cylinder = transform.GetChild(7);
    }
Esempio n. 2
0
    public void setTile(GridTile til)
    {
        tile = til;

        WindController.GetWindAtTile(til, 0);
        biome.text = biomes[Mathf.FloorToInt(tile.biome)];
        if (true /*tile.occupant == null*/)
        {
            occupant.text = "None";
        }
        //else
        //{
        //    if (tile.occupant.obj.name.Equals("RockEmpty(Clone)") || tile.occupant.obj.name.Equals("StoneCubeEmpty(Clone)"))
        //    {
        //        occupant.text = "A rock";
        //    } else if (tile.occupant.obj.name.Equals("House Colored"))
        //    {
        //        occupant.text = "A house";
        //    } else if(tile.occupant.obj.name.Equals("NewTreeEmpty(Clone)"))
        //    {
        //        occupant.text = "A tree";

        //    } else if (tile.occupant.obj.name.Equals("CactusEmpty(Clone)"))
        //    {
        //        occupant.text = "A cactus";
        //    }
        //    else
        //    {
        //        occupant.text = "Wind Turbine";
        //    }
        //}
        //position.text = tile.position.ToString("F0");
    }
Esempio n. 3
0
        private void RestoreWind(Level level)
        {
            level.Wind = Instance.SavedLevel.Wind;
            WindController windController      = level.Entities.FindFirst <WindController>();
            WindController savedWindController = Instance.SavedLevel.Entities.FindFirst <WindController>();

            windController.CopyFields(savedWindController, "pattern");
        }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        windController = GameObject.Find("Wind").GetComponent <WindController>();
        updateTarget();

        StartCoroutine(moveCloud());
        speed = Random.Range(0.2f, 0.5f);
    }
Esempio n. 5
0
    /// <summary>
    /// Finds the wind object, gets wind vector and sets local version. This is called by oceancontroller when tile is changed.
    /// This way only works if there is only one gameobject with the name "Wind"
    /// </summary>
    public void UpdateWind()
    {
        WindController windController = GameObject.Find("Wind").gameObject.GetComponent <WindController>();

        if (!windController)
        {
            throw new UnassignedReferenceException("Cannot find 'WindController' script");
        }
        wind = windController.WindVector;
    }
Esempio n. 6
0
 void Awake()
 {
     #region Singleton
     if (instance != null)
     {
         Debug.LogError("Multiple instances of " + this + " found");
     }
     instance = this;
     #endregion
 }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        body        = GetComponent <Rigidbody> ();
        player      = GameObject.Find("Player").GetComponent <Player> ();
        wind        = GameObject.Find("Terrain").GetComponent <WindController> ();
        thermals    = GameObject.Find("Thermal").GetComponent <Thermal>();
        gliderLines = transform.FindChild("gliderLines").gameObject;
        Reference.blowables.Add(this);

        originAngleOfAttack = angleOfAttack;
    }
        private static void FixWindSoundNotPlay(On.Celeste.WindController.orig_SetAmbienceStrength orig,
                                                WindController self,
                                                bool strong)
        {
            if (Audio.CurrentAmbienceEventInstance == null)
            {
                Audio.SetAmbience("event:/env/amb/04_main");
            }

            orig(self, strong);
        }
Esempio n. 9
0
    private void FixedUpdate()
    {
        if (isWork && nextTime < Time.time)
        {
            windIns = Instantiate(wind, this.transform.position, Quaternion.identity);
            WindController windPara = windIns.GetComponent <WindController>();
            windPara.speed       = 1;
            windPara.banishPoint = 44;

            nextTime = Time.time + 1;
        }
    }
        private void applyWind(Level level)
        {
            if (Settings.WindEverywhere != 0)
            {
                if (!snowBackdropAddedByEVM)
                {
                    // add the styleground / backdrop used in Golden Ridge to make wind actually visible.
                    // ExtendedVariantWindSnowFG will hide itself if a vanilla backdrop supporting wind is already present or appears.
                    level.Foreground.Backdrops.Add(new ExtendedVariantWindSnowFG()
                    {
                        Alpha = 0f
                    });
                    snowBackdropAddedByEVM = true;
                }

                // also switch the audio ambience so that wind can actually be heard too
                // (that's done by switching to the ch4 audio ambience. yep)
                Audio.SetAmbience("event:/env/amb/04_main", true);

                WindController.Patterns selectedPattern;
                if (Settings.WindEverywhere == AvailableWindPatterns.Length + 1)
                {
                    // pick up random wind
                    selectedPattern = AvailableWindPatterns[randomGenerator.Next(AvailableWindPatterns.Length)];
                }
                else
                {
                    // pick up the chosen wind pattern
                    selectedPattern = AvailableWindPatterns[Settings.WindEverywhere - 1];
                }

                // and apply it; this is basically what Wind Trigger does
                WindController windController = level.Entities.FindFirst <WindController>();
                if (windController == null)
                {
                    windController = new WindController(selectedPattern);
                    windController.SetStartPattern();
                    level.Add(windController);
                    level.Entities.UpdateLists();
                }
                else
                {
                    windController.SetPattern(selectedPattern);
                }
            }
            else if (snowBackdropAddedByEVM)
            {
                // remove the backdrop
                level.Foreground.Backdrops.RemoveAll(backdrop => backdrop.GetType() == typeof(ExtendedVariantWindSnowFG));
                snowBackdropAddedByEVM = false;
            }
        }
Esempio n. 11
0
        private void ChangeWind(WindController.Patterns wind)
        {
            WindController first = Scene.Entities.FindFirst <WindController>();

            if (first == null)
            {
                Scene.Add(new WindController(wind));
            }
            else
            {
                first.SetPattern(wind);
            }
        }
Esempio n. 12
0
 void Start()
 {
     if (MyFactory == null)
     {
         MyFactory = new Factory();
     }
     MyFactory.init();
     if (windController == null)
     {
         windController = new WindController();
     }
     windController.windChange();
 }
Esempio n. 13
0
    bool GetDependencies()
    {
        rb = GetComponent <Rigidbody>();

        if (GameObject.FindGameObjectWithTag(WindController.gameManagerTag) == null)
        {
            Debug.LogError("Can't find WindController from GameManager!");
            return(false);
        }
        else
        {
            wind = GameObject.FindGameObjectWithTag(WindController.gameManagerTag).GetComponent <WindController>();
        }
        return(true);
    }
Esempio n. 14
0
    public bool levelGenerating;     // used to ensure that two levels aren't made at the same time

    void Start()
    {
        audioManager     = AudioManager.instance;
        cameraController = CameraController.instance;
        cannonController = CannonController.instance;
        cloudController  = CloudController.instance;
        inputManager     = InputManager.instance;
        prefabPlacer     = PrefabPlacer.instance;   // set up all pathways
        target           = Target.instance;
        terrainGenerator = TerrainGenerator.instance;
        UIManager        = UIManager.instance;
        windController   = WindController.instance;

        cloudController.StartCoroutine(cloudController.CloudSpammer()); // start the cloudSpammer coroutine
        StartGame();
    }
Esempio n. 15
0
        public void WindAction(string parameter)
        {
            Module.BirdyHelper.BirdCaw();

            WindController.Patterns pattern = WindController.Patterns.Right;

            if (parameter.IndexOf("left", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Left;
            }
            else if (parameter.IndexOf("right", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Right;
            }
            else if (parameter.IndexOf("up", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Up;
            }
            else if (parameter.IndexOf("down", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Down;
            }

            if (!Settings.WindEnabled)
            {
                currentLevel.Foreground.Backdrops.Add(new CrowControlWindSnowFG()
                {
                    Alpha = 0f
                });
                Audio.SetAmbience("event:/env/amb/04_main", true);

                WindController controller = currentLevel.Entities.FindFirst <WindController>();

                if (controller == null)
                {
                    controller = new WindController(pattern);
                    controller.SetStartPattern();
                    currentLevel.Add(controller);
                }
                else
                {
                    controller.SetPattern(pattern);
                }

                Settings.WindEnabled = true;
            }
        }
Esempio n. 16
0
 private void Awake()
 {
     lock (padlock)
     {
         if (_instance != null && _instance != this)
         {
             Destroy(this.gameObject);
         }
         else
         {
             _instance = this;
             //Here any additional initialization should occur:
             State = 0;
         }
     }
     //DontDestroyOnLoad(this.gameObject);
 }
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     m_acc       = 22;
     m_jumpPower = 247;
     m_maxSpeed  = 10;
     //m_jumpDelay = 2.2f;
     m_frozen      = false;
     m_facingRight = true;
     m_grounded    = false;
     m_accVec      = new Vector2(m_acc, 0);
     //m_groundCheckPos0 = new Vector2(transform.position.x - 0.4f, transform.position.y -0.4f);
     //m_groundCheckPos1 = new Vector2(transform.position.x + 0.4f, transform.position.y -0.4f);
     m_scoring        = GameObject.Find("InGameData").GetComponent <Scoring>();
     m_animator       = GetComponent <Animator>();
     m_inputTouch     = GameObject.Find("TouchHandler").GetComponent <InputTouch>();
     m_windController = GetComponent <WindController>();
 }
Esempio n. 18
0
    void Start()
    {
        Screen.orientation = ScreenOrientation.LandscapeLeft;

        _currentSceneState = SceneState.Unfavorable;

        _dayNightCycleController   = new DayNightCycleController();
        _windController            = new WindController();
        _cloudController           = new CloudController(StartCoroutine);
        _rainController            = new RainController();
        _temperatureController     = new TemperatureController(StartCoroutine, _dayNightCycleController);
        _waterController           = new WaterController();
        _terrainController         = new TerrainController(StartCoroutine);
        _snowController            = new SnowController();
        _treeGrowthStateController = new TreeGrowthStateController(StartCoroutine, _windController.UpdateTreeWindForceOnGrow);

        _sceneRestarted = false;
    }
Esempio n. 19
0
        public static void Teleport(this Level self, string levelName, Func <Vector2?> spawnPointFunc)
        {
            Glitch.Value     = 0f;
            Engine.TimeRate  = 1f;
            Distort.Anxiety  = 0f;
            Distort.GameRate = 1f;
            Audio.SetMusicParam("fade", 1f);
            self.ParticlesBG.Clear();
            self.Particles.Clear();
            self.ParticlesFG.Clear();
            TrailManager.Clear();
            if (self.Tracker.GetEntity <Player>() is Player player)
            {
                self.Remove(player);
            }
            self.UnloadLevel();
            GC.Collect();
            GC.WaitForPendingFinalizers();
            self.Session.Level = levelName;
            Vector2?spawnPoint = spawnPointFunc.Invoke();

            if (spawnPoint == null)
            {
                spawnPoint = self.GetSpawnPoint(new Vector2(self.Bounds.Left, self.Bounds.Top));
            }
            self.Session.RespawnPoint = spawnPoint;
            self.LoadLevel(Player.IntroTypes.None);
            self.strawberriesDisplay.DrawLerp = 0f;
            WindController windController = self.Entities.FindFirst <WindController>();

            if (windController != null)
            {
                windController.SnapWind();
            }
            else
            {
                self.Wind = Vector2.Zero;
            }
        }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        //m_clouds = new Queue<GameObject>();

        WorldLimits worldLimits = Camera.main.GetComponent <WorldLimits>();

        m_worldSpaceWidth  = worldLimits.WorldSpaceWidth;
        m_worldSpaceHeight = worldLimits.WorldSpaceHeight;

        m_player = GameObject.FindWithTag("Player").transform;
        Debug.Log("Player found at pos: " + m_player.position);

        m_windController = m_player.gameObject.GetComponent <WindController>();
        StartCoroutine("MoveCloudsHorizontal");

        LinkedListNode <GameObject> it;

        for (it = m_clouds.First; it != m_clouds.Last.Next; it = it.Next)
        {
            m_windController.registerCloud(it.Value);
        }

        //m_mainCameraTransform = Camera.main.transform;

        //m_platformSpawner = GameObject.Find("Spawner").GetComponent<SpawnJumperPlatforms>();

        /*for(ushort i = 0; i < 10; ++i)
        *       {
        *               Vector2 newCloudPos = m_platformSpawner.NewestPlatPos;
        *               newCloudPos.x += (Random.value - 0.5f) * 2f * m_worldSpaceWidth;
        *               newCloudPos.y += (Random.value - 0.5f) * 2f * m_worldSpaceHeight;
        *               GameObject newCloud = Instantiate(m_cloudPrefabs[Random.Range(0, 2)], newCloudPos, Quaternion.identity) as GameObject;
        *               m_clouds.AddLast(newCloud.transform);
        *       }
        *
        *       StartCoroutine("SpawnClouds");*/
    }
Esempio n. 21
0
    float CpDesign()
    {
        float V_rated  = uniProperties.ratedCutoffProperty.minPropertyValue;
        float V_cutoff = uniProperties.ratedCutoffProperty.maxPropertyValue;
        float height   = uniProperties.heightProperty.propertyValue;
        float V        = WindController.GetWindAtTile(onGridtile, height);

        if (V < Vcutin)
        {
            return(0);
        }
        else if (Vcutin < V && V <= V_rated)
        {
            return(CpReference());
        }
        else if (V_rated < V && V <= V_cutoff)
        {
            return(CpFormula(V, V_rated, V_cutoff));
        }
        else
        {
            return(0);
        }
    }
Esempio n. 22
0
 void Start()
 {
     wind = GameObject.FindObjectOfType <WindController>();
 }
Esempio n. 23
0
    // Use this for initialization
    void Start()
    {
        body = GetComponent<Rigidbody> ();
        player = GameObject.Find ("Player").GetComponent<Player> ();
        wind = GameObject.Find ("Terrain").GetComponent<WindController> ();
        thermals = GameObject.Find("Thermal").GetComponent<Thermal>();
        gliderLines = transform.FindChild ("gliderLines").gameObject;
        Reference.blowables.Add (this);

        originAngleOfAttack = angleOfAttack;
    }
Esempio n. 24
0
    void CalculateChunk(object args)
    {
        object[] argsArr = (object[])args;
        int      i       = (int)argsArr[0];
        float    time    = (float)argsArr[1];

        int operationsPerThread = Mathf.CeilToInt(windSpeedChunks.Count / chunkThreads.Length);
        int windCount           = windSpeedChunks.Count;

        int startK = (int)i * operationsPerThread;
        int endK   = ((int)i + 1) * operationsPerThread;

        for (int k = startK; k < endK; k++)
        {
            if (k >= windCount)
            {
                break;
            }

            if (!windSpeedChunks[k].isEnabled)
            {
                continue;
            }

            List <Vector3> vert = threadVerts[k];

            for (int j = 0; j < vert.Count; j++)
            {
                GridTile tile = GridTile.FindClosestGridTile(vert[j]);

                if (tile != null && tile.canSeeWind && !tile.isOutsideBorder)
                {
                    float   curWind = WindController.GetWindAtTile(tile, height, time);
                    Vector2 curUv   = new Vector2(1 - curWind / WindController.WindMagnitudeAtTime(time), 1 - curWind / WindController.WindMagnitudeAtTime(time));
                    for (int intp = 0; intp < intpSteps; intp++)
                    {
                        if (curUvs)
                        {
                            Vector2 interpolated = Vector2.Lerp(buffereduvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1));

                            uvs[k][intp][j].Set(interpolated.x, interpolated.y);
                        }
                        else
                        {
                            Vector2 interpolated = Vector2.Lerp(uvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1));

                            buffereduvs[k][intp][j].Set(interpolated.x, interpolated.y);
                        }

                        if (stopThreads)
                        {
                            return;
                        }
                    }
                }
                else if (tile != null && !tile.canSeeWind && !tile.isOutsideBorder)
                {
                    Vector2 curUv = new Vector2(0.125f, 0.875f);

                    for (int intp = 0; intp < intpSteps; intp++)
                    {
                        if (curUvs)
                        {
                            Vector2 interpolated = Vector2.Lerp(buffereduvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1));

                            uvs[k][intp][j].Set(interpolated.x, interpolated.y);
                        }
                        else
                        {
                            Vector2 interpolated = Vector2.Lerp(uvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1));

                            buffereduvs[k][intp][j].Set(interpolated.x, interpolated.y);
                        }

                        if (stopThreads)
                        {
                            return;
                        }
                    }
                }
            }
        }
    }
Esempio n. 25
0
 // Update is called once per frame
 void Update()
 {
     windSpeed.text     = WindController.GetMaximumWind().ToString();
     windDirection.text = WindDirection();
 }
Esempio n. 26
0
 private void Start()
 {
     instance = this;
     PlayerController.respawn = true;
 }
Esempio n. 27
0
    private void FixedUpdate()
    {
        // Calculate wait
        if (!jump && horizonMove == 0)
        {
            ++waitTime;
        }
        else
        {
            waitTime = 0f;
        }
        // Judge player static
        if (waitTime >= staticWaitTime)
        {
            StopFloating();
        }
        // Update floatCheck position
        floatCheck.position = new Vector3(
            groundCheck.position.x,
            floatCheck.position.y,
            floatCheck.position.z
            );
        // Update ground position
        groundPos = new Vector3(transform.position.x, groundPos.y, groundPos.z);

        // Judge if ground
        isGrounded = false;
        Collider2D[] colliders =
            Physics2D.OverlapCircleAll(groundCheck.position, checkRadius, groundLayer);
        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].gameObject != gameObject)
            {
                isGrounded          = true;
                floatCheck.position = groundCheck.position;
                groundPos           = transform.position;
                floatPos            = groundCheck.position.y + floatHeight;
            }
        }

        // Judge if float over ground
        if (isFloating)
        {
            StopFloating();
            colliders =
                Physics2D.OverlapCircleAll(floatCheck.position, checkRadius, groundLayer);
            for (int i = 0; i < colliders.Length; i++)
            {
                if (colliders[i].gameObject != gameObject)
                {
                    KeepFloating();
                }
            }
        }
        // Handle wind force
        if (inWindZone)
        {
            jump = false;
            WindController wind = windZone.GetComponent <WindController>();
            rb2d.velocity = new Vector2(rb2d.velocity.x, 0);
            rb2d.AddForce(wind.direction * wind.strength);
        }
        // Handle Player animation
        if (!animator.GetCurrentAnimatorStateInfo(0).IsName("CloseEye"))
        {
            if (isGrounded || isFloating)
            {
                if (horizonMove > 0 && currentState != "Rightward")
                {
                    animator.Play("Rightward");
                    currentState = "Rightward";
                }
                else if (horizonMove < 0 && currentState != "Leftward")
                {
                    animator.Play("Leftward");
                    currentState = "Leftward";
                }
                else if (horizonMove == 0 && currentState != "Normal")
                {
                    animator.Play("Normal");
                    currentState = "Normal";
                }
            }
            else if (horizonMove == 0)
            {
                if (rb2d.velocity.y > 0 && currentState != "Upward")
                {
                    animator.Play("Upward");
                    currentState = "Upward";
                }
                else if (rb2d.velocity.y < 0 && currentState != "Downward")
                {
                    animator.Play("Downward");
                    currentState = "Downward";
                }
            }
        }
        // Handle move
        Move();
        jump = false;
    }
 void Awake()
 {
     instance = this;
 }
Esempio n. 29
0
 // Use this for initialization
 void Start()
 {
     waterPhys = GetComponent<WaterPhysics> ();
     windPower = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WindController>();
 }
Esempio n. 30
0
    public Image windStrength;       // image GUI

    void Start()
    {
        cannonController = CannonController.instance;   // create the pathways to the instances
        windController   = WindController.instance;
    }
Esempio n. 31
0
        private static void FixWindSoundNotPlay(On.Celeste.WindController.orig_SetAmbienceStrength orig, WindController self, bool strong)
        {
            if (SpeedrunToolModule.Enabled && Audio.CurrentAmbienceEventInstance == null && Engine.Scene.GetSession()?.Area.LevelSet == "Celeste")
            {
                Audio.SetAmbience("event:/env/amb/04_main");
            }

            orig(self, strong);
        }
    public float spawnTimeBuffer;                    // range of time adjustments

    private void Start()
    {
        windController = WindController.instance;            // access the windController instance and save the path
        spawnTimer     = averageSpawnTime + spawnTimeBuffer; // set the spawntime to it's maximum possible wait
    }