public void UpdateDamage(int customSpeed = -1)
    {
        SetWaterInBoat();

        int newSpeed = MaxHull - hull;

        if (customSpeed != -1)
        {
            newSpeed = customSpeed;
        }

        if (SpeedValueManager.GetSpeedValues().Count > newSpeed)
        {
            RiverController.instance.minimumSpeed = SpeedValueManager.GetSpeedValues()[newSpeed].riverSpeed;

            GameObject option = null;
            option = GameObject.Find("PlayerOneSpot");
            if (option != null)
            {
                option.GetComponent <PlayerSpot>().SetSpeedValues(newSpeed);
            }

            option = GameObject.Find("PlayerTwoSpot");
            if (option != null)
            {
                option.GetComponent <PlayerSpot>().SetSpeedValues(newSpeed);
            }
        }
    }
    public void SetSpeedValues(int damage)
    {
        if (SpeedValueManager.GetSpeedValues().Count > damage)
        {
            SpeedValue newValue = SpeedValueManager.GetSpeedValues()[damage];

            turnForwardForce  = newValue.turnForwardForce;
            turnBackwardForce = newValue.turnBackwardForce;
            forwardForce      = newValue.forwardForce;
            backwardForce     = newValue.backwardForce;
            //maximumSpeed = newValue.maximumSpeed;
            sidePushForce = newValue.sidePushForce;
            paddleTime    = newValue.paddleTime;
        }
    }
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            other.GetComponent <BoatClass>().UpdateDamage(SpeedValueManager.GetSpeedValues().Count - 1);
        }

        if (other.GetComponent <FloatingObject>())
        {
            if (observerdObjects.Contains(other.GetComponent <FloatingObject>()) == false)
            {
                other.GetComponent <FloatingObject>().observers.Add(gameObject);
                observerdObjects.Add(other.GetComponent <FloatingObject>());
            }
        }
    }
    private void Start()
    {
        minimumSpeed = SpeedValueManager.GetSpeedValues()[0].riverSpeed;
        if (instance != null)
        {
            Debug.LogWarning("Multiple RiverControllers Detected");
        }
        instance = this;

        bool allWorking = true;


        if (GameObject.FindGameObjectWithTag("Player"))
        {
            if (observedObjects.Contains(GameObject.FindGameObjectWithTag("Player").GetComponent <FloatingObject>()) == false)
            {
                observedObjects.Add(GameObject.FindGameObjectWithTag("Player").GetComponent <FloatingObject>());
            }
        }

redo:
        for (int i = 0; i < observedObjects.Count; i++)
        {
            if (observedObjects[i] == null)
            {
                observedObjects.RemoveAt(i);
                goto redo;
            }
        }

        if (allWorking)
        {
            GameObject pool = GameObject.Find("EffectsPool");
            if (pool != null)
            {
                effectsPool = pool.transform;
            }
            else
            {
                effectsPool = new GameObject("EffectsPool").transform;
            }

            BuildMesh();

            for (int i = 0; i < transform.childCount; i++)
            {
                transform.GetChild(i).GetComponent <MeshFilter>().mesh = mesh;
            }

            /*
             * if(gameObject.GetComponent<MeshCollider>() == null)
             *  gameObject.AddComponent<MeshCollider>();
             * gameObject.GetComponent<MeshCollider>().sharedMesh = mesh;
             */
            if (endTransform != null)
            {
                endTransform.position = riverAsset.nodes[riverAsset.nodes.Length - 1].centerVector;
            }
        }
        else
        {
            Debug.LogError("Oh No! Something is wrong, dont worry. I stoped the game so you can fix it in ease.");
            if (Application.isEditor)
            {
                Debug.DebugBreak();
            }
        }
    }