Beispiel #1
0
        public List <string> PrintStrLoad(string towerType)
        {
            List <string> rslt = new List <string>();

            string str = FileUtils.PadRightEx("受风面积:" + WindArea.ToString("0.##"), 16);

            rslt.Add(str);

            string strTitle = FileUtils.PadRightEx("气象条件", 26) + FileUtils.PadRightEx("温度:", 8) + FileUtils.PadRightEx("风速:", 8) + FileUtils.PadRightEx("覆冰:", 8)
                              + FileUtils.PadRightEx("基本风速:", 12) + FileUtils.PadRightEx("风荷载:", 12) + FileUtils.PadRightEx("垂直荷载:", 12);

            rslt.Add(strTitle);

            List <string> wkCdtList = towerType == "悬垂塔" ? WireData.WorkCdtNamesHang : WireData.WorkCdtNamesStrain;

            foreach (var name in wkCdtList)
            {
                var wea = WireData.WeatherParas.WeathComm.Where(item => item.Name == name).FirstOrDefault();

                if (wea == null)
                {
                    continue;
                }

                string strValue = FileUtils.PadRightEx(name, 26) + FileUtils.PadRightEx(wea.Temperature.ToString(), 8) + FileUtils.PadRightEx(wea.WindSpeed.ToString(), 8) + FileUtils.PadRightEx(wea.IceThickness.ToString(), 8)
                                  + FileUtils.PadRightEx(wea.BaseWindSpeed.ToString(), 12) + FileUtils.PadRightEx(StrLoad[name].WindLoad.ToString("0.###"), 12) + FileUtils.PadRightEx(StrLoad[name].VerLoad.ToString("0.###"), 12);
                rslt.Add(strValue);
            }

            return(rslt);
        }
Beispiel #2
0
    void Start()
    {
        ourShip = this.gameObject;

        enemyBoatController     = GetComponent <EnemyBoatController>();
        angleBetweenShipAndWind = GetComponent <AngleBetweenShipAndWind>();
        windArea = GameObject.Find("Wind Area").GetComponent <WindArea>();

        corner0 = GameObject.Find("Corner 0");
        corner1 = GameObject.Find("Corner 1");
        corner2 = GameObject.Find("Corner 2");
        corner3 = GameObject.Find("Corner 3");

        minDistBetweenParallel = 10;
        maxDistBetweenParallel = 30;

        cannonsTimeOfNextFire = new float[6];
        for (int i = 0; i < cannonsTimeOfNextFire.Length; i++)
        {
            cannonsTimeOfNextFire[i] = Time.time;
        }

        enemyBoatController.SailsDown();
        changeDirectionTime = Time.time + RandomPeriodOfTime();
        activeState         = state_PlayerSearch;
    }
 void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.tag == "windArea")
     {
         isInWindArea = true;
         windArea     = coll.gameObject.GetComponent <WindArea>();
     }
 }
Beispiel #4
0
 void OnTriggerExit(Collider coll)
 {
     if (coll.gameObject.tag == "WindZone")
     {
         windZone   = null;
         inWindZone = false;
     }
 }
Beispiel #5
0
 void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.tag == "WindZone")
     {
         windZone   = coll.gameObject.GetComponent <WindArea>();
         inWindZone = true;
     }
 }
 void OnTriggerExit(Collider coll)
 {
     if (coll.gameObject.tag == "windArea")
     {
         isInWindArea      = false;
         windArea          = null;
         forceActingOnSail = Vector3.zero;
     }
 }
    void OnTriggerExit2D(Collider2D coll)
    {
        WindArea _windArea = coll.gameObject.GetComponent <WindArea>();

        if (_windArea != null)
        {
            windZone        = null;
            unit.inWindZone = false;
        }
    }
    void OnTriggerEnter2D(Collider2D coll)
    {
        WindArea _windArea = coll.gameObject.GetComponent <WindArea>();

        if (_windArea != null)
        {
            windZone = _windArea;

            unit.inWindZone = true;
            unit.WindZoneStats(windZone.direction, windZone.strength, windZone.fromLeft, windZone.doesAffectMovement, windZone.isBorasWind);
        }
    }
Beispiel #9
0
    // Use this for initialization
    void OnEnable()
    {
        mWindArea = GameObject.FindGameObjectWithTag("WindArea").GetComponent <WindArea>();


        X = mWindArea.direction.x * IslandSpeed * Time.deltaTime;    //-player.GetComponent<Rigidbody>().velocity.x/ (2*playerMaxSpeed);
        Z = mWindArea.direction.z * IslandSpeed * Time.deltaTime;

        float WhenToDestroy = 60f * 1.5f;

        StartCoroutine((Disable(WhenToDestroy)));
        //Destroy(this.gameObject, WhenToDestroy);


        StartCoroutine(Move());
    }
Beispiel #10
0
 /// <summary>
 /// Creates a new WindArea with values copied from another.
 /// </summary>
 public WindArea(WindArea clone) : base(clone)
 {
 }
Beispiel #11
0
 void Awake()
 {
     windArea = GameObject.Find("Wind Area").GetComponent <WindArea>();
 }
    // -----------------------------------------------------------------------
    public static float GetAngleInDegToAvoidObstacle(GameObject ourShip, GameObject obstacle, WindArea windArea, float additionalRandomAngle)
    {
        Vector3 shipDirection = ourShip.transform.forward;

        float angleBetweenShortestShiptToObstacleVectorAndShipDirection =
            GetAngleBetweenShortestShiptToObstacleVectorAndShipDirection(obstacle, ourShip.transform); //this is a signed angle - range: 0-180 or 0-(-180)

        float angleInDegToAvoidObstacle;

        if (angleBetweenShortestShiptToObstacleVectorAndShipDirection > 0)
        {
            angleInDegToAvoidObstacle = (90 - angleBetweenShortestShiptToObstacleVectorAndShipDirection) + additionalRandomAngle;

            // due to wind correction of angleInDegToAvoidObstacle
            Vector3 rotatedVector = GetRotatedVector(shipDirection, angleInDegToAvoidObstacle * Mathf.Deg2Rad);
            if (GetVectorToWindAngle(rotatedVector, windArea.windDirection) > 150)
            {
                angleInDegToAvoidObstacle += GetVectorToWindAngle(rotatedVector, windArea.windDirection) - 150;
            }
        }
        else if (angleBetweenShortestShiptToObstacleVectorAndShipDirection < 0)
        {
            angleInDegToAvoidObstacle = (-90 - angleBetweenShortestShiptToObstacleVectorAndShipDirection) - additionalRandomAngle;

            // due to wind correction of angleInDegToAvoidObstacle
            Vector3 rotatedVector = GetRotatedVector(shipDirection, angleInDegToAvoidObstacle * Mathf.Deg2Rad);
            if (GetVectorToWindAngle(rotatedVector, windArea.windDirection) < -150)
            {
                angleInDegToAvoidObstacle += GetVectorToWindAngle(rotatedVector, windArea.windDirection) + 150;
            }
        }
        else
        { //perpendicular
            angleInDegToAvoidObstacle = 90 + 20;
        }

        return(angleInDegToAvoidObstacle);
    }
Beispiel #13
0
    //private float playerMaxSpeed;

    // Use this for initialization
    void Start()
    {
        mWindArea = GameObject.FindGameObjectWithTag("WindArea").GetComponent <WindArea>();
        //playerMaxSpeed = Joystick2.max_Speed;
    }
 private void OnEnable()
 {
     windArea = (WindArea)target;
 }
 void Start()
 {
     windArea = GetComponent <WindArea>();
     CreateWindArrow();
     initArrowScale = windArrow.transform.localScale;
 }