コード例 #1
0
    //-------------------------------------------------
    // All shape management functions (add shapes, save shapes to metadata etc.
    //-------------------------------------------------

    public void AddShape(Vector3 shapePosition, Quaternion shapeRotation, int shapeType, string Shapename)
    {
        ShapeInfo shapeInfo = new ShapeInfo();

        shapeInfo.px        = shapePosition.x;
        shapeInfo.py        = shapePosition.y;
        shapeInfo.pz        = shapePosition.z;
        shapeInfo.qx        = shapeRotation.x;
        shapeInfo.qy        = shapeRotation.y;
        shapeInfo.qz        = shapeRotation.z;
        shapeInfo.qw        = shapeRotation.w;
        shapeInfo.shapeType = shapeType.GetHashCode();
        shapeInfo.name      = Shapename;
        shapeInfo.infoIndex = inputmanager.index;
        shapeInfo.linkMapID = inputmanager.LinkID;
        shapeInfoList.Add(shapeInfo);
        Debug.Log(shapeInfo.name);
        GameObject shape = ShapeFromInfo(shapeInfo, false);         // instantiate shape from info

        NodeCount++;

        DestinationTarget temp = shape.GetComponent <DestinationTarget>();

        if (temp != null)
        {
            NodeCount--;
        }

        shapeObjList.Add(shape);
        inputmanager.ResetNameAndIndex();
    }
コード例 #2
0
 void VisitNextPatrolPathDestination()
 {
     if (PatrolPath.Count > 0)
     {
         DestinationTarget destinationTarget = new DestinationTarget(PatrolPath[++CurrentPatrolPathDestinationIndex % PatrolPath.Count], null);
         SetDestinationTarget(destinationTarget);
     }
 }
コード例 #3
0
    public override void SetDestinationTarget(DestinationTarget destinationTarget)
    {
        Destination = TransformCached.position;
        NextDestinations.Clear();
        Vector3    dest = destinationTarget.Destination;
        RaycastHit hit  = new RaycastHit();

        if (Physics.Raycast(TransformCached.position, TransformCached.forward, out hit))
        {
            dest = new Vector3(hit.point.x, hit.transform.root.position.y, hit.point.z);
        }
        NextDestinations.Push(dest);
        Target = destinationTarget.Target;
    }
コード例 #4
0
    //-------------------------------------------------
    // All shape management functions (add shapes, save shapes to metadata etc.
    //-------------------------------------------------

    public void AddShape(Vector3 shapePosition, Quaternion shapeRotation, bool isDestination, string name)
    {
        int typeIndex = 0;        //sphere

        if (isDestination)
        {
            typeIndex = 1;            //diamond
        }
        Debug.Log(typeIndex);

        ShapeInfo shapeInfo = new ShapeInfo();

        shapeInfo.px        = shapePosition.x;
        shapeInfo.py        = shapePosition.y;
        shapeInfo.pz        = shapePosition.z;
        shapeInfo.qx        = shapeRotation.x;
        shapeInfo.qy        = shapeRotation.y;
        shapeInfo.qz        = shapeRotation.z;
        shapeInfo.qw        = shapeRotation.w;
        shapeInfo.shapeType = typeIndex.GetHashCode();
        shapeInfo.name      = name;
        shapeInfo.infoIndex = inputmanager.index;
        shapeInfo.linkMapID = inputmanager.LinkID;
        shapeInfoList.Add(shapeInfo);
        Debug.Log(shapeInfo.name);
        GameObject shape = ShapeFromInfo(shapeInfo, false);         // instantiate shape from info

        NodeCount++;

        DestinationTarget temp = shape.GetComponent <DestinationTarget>();

        if (temp != null)
        {
            NodeCount--;

            /*temp.Activate(true);
             * temp.DestinationName = name;
             * temp.linkMapID = inputmanager.LinkID;*/
        }

        shapeObjList.Add(shape);
        inputmanager.ResetNameAndIndex();
    }
コード例 #5
0
    public virtual void SetDestinationTarget(DestinationTarget destinationTarget)
    {
        List <Vector3> path = PathFinder.Dijkstra(LevelManager.CurrentLevel, TransformCached.position, LevelManager.LevelGridCoords(destinationTarget.Destination));

        if (path.Count < 1)
        {
            HandleNoPathToDestination();
        }
        else
        {
            path.Add(TransformCached.position);
            path        = PathFinder.SmoothenPath(path);
            path[0]     = destinationTarget.Destination;
            Destination = TransformCached.position;
            NextDestinations.Clear();
            foreach (Vector3 point in path)
            {
                NextDestinations.Push(point);
            }
            Target = destinationTarget.Target;
        }
    }
コード例 #6
0
 void Start()
 {
     nameText      = GetComponent <TextMeshProUGUI>();
     destination   = GetComponentInParent <DestinationTarget>();
     nameText.text = destination.DestinationName;
 }
コード例 #7
0
 public override void SetDestinationTarget(DestinationTarget destinationTarget)
 {
     base.SetDestinationTarget(destinationTarget);
     remainingRestTimeSeconds = RestTimeSeconds;
 }