Пример #1
0
    private void influenceSingleObjectByWind(IInfluenceableByWind _influencableObject) 
    {
        if(m_listExistingLinearWinds.Count > 0)
        {
            Vector3 v3ObjectPosition = _influencableObject.Position;

            Vector3 v3ResultngWindDirection = new Vector3();

            float fResultingWindForce = 0f;

            foreach(LinearWind wind in m_listExistingLinearWinds) 
            {
                Ray ray = new Ray(wind.Position, wind.Direction);

                Vector3 v3NearestPointOnRay = MathHelper.v3GetNearestPointOnRay(ray, v3ObjectPosition);

                float fSmallestDistanceObjectWind = MathHelper.fGetSmallestDistanceToStraight(ray, v3NearestPointOnRay, v3ObjectPosition);

                if(fSmallestDistanceObjectWind < wind.Radius) {
                    fResultingWindForce += (wind.Radius / fSmallestDistanceObjectWind * wind.Force);
                    v3ResultngWindDirection += wind.Direction.normalized;
                }
            }

            if (fResultingWindForce > 0) {
                _influencableObject.influence(v3ResultngWindDirection.normalized, fResultingWindForce);
            }
        }
    }
Пример #2
0
 private void addBalloonToInfluenceableByWindList() 
 {
 
     IInfluenceableByWind goInfluenceableByWind = m_goBalloon.GetComponent<IInfluenceableByWind>();
     
     if (!m_listInfluenceablesByWind.Contains(goInfluenceableByWind))
     {
         m_listInfluenceablesByWind.Add(goInfluenceableByWind);
     }
 }
Пример #3
0
 public void addObjectInfluenceableByWind(IInfluenceableByWind _influenceableObject) 
 {
     m_listInfluenceablesByWind.Add(_influenceableObject);
 }