コード例 #1
0
ファイル: PersonInstantiator.cs プロジェクト: ppedra/SA4
 ///<summary>
 /// return position inside sea area
 ///</summary>
 public Vector3[] GetStartPositionAtSea()
 {
     Vector3[] positions = this.GetStartAndEndPosition(true);
     //change start position for inside the sea
     positions[0] = AreaInsideSea.GetRandomPositionInsideArea();
     Debug.Log(positions[0]);
     return(positions);
 }
コード例 #2
0
ファイル: PersonInstantiator.cs プロジェクト: ppedra/SA4
    ///<summary>
    /// return 2 vec3 with start and end position for the generic person
    /// to move.
    ///</summary>
    ///<param name="InstantiateInMiddle"> should instantiate in middle of map </param>
    public Vector3[] GetStartAndEndPosition(bool InstantiateInMiddle)
    {
        Vector3 startPos;
        Vector3 endPos;

        int option = Random.Range(0, 2);

        if (option == 0)
        {
            startPos = AreaRight.GetRandomPositionInsideArea();
            endPos   = AreaLeft.GetRandomPositionInsideArea();
        }
        else
        {
            startPos = AreaLeft.GetRandomPositionInsideArea();
            endPos   = AreaRight.GetRandomPositionInsideArea();
        }
        // get point inside map area
        if (InstantiateInMiddle)
        {
            startPos = AreaInsideSand.GetRandomPositionInsideArea();
        }
        return(new Vector3[] { startPos, endPos });
    }