Ejemplo n.º 1
0
    ////////////////////////////////////////////////

    public static void MakeActiveUnitMove_CLIENT(Vector3 posToMoveTo)
    {
        if (_activeUnit)
        {
            List <Vector3> movePath = MovementManager.SetUnitsPath(_activeUnit, _activeUnit.CubeUnitIsOn.CubeStaticLocVector, posToMoveTo);

            int[] pathInts = DataManipulation.ConvertVectorsIntoIntArray(movePath);

            int unitID = (int)_activeUnit.netId.Value;
            MovementManager.CreatePathFindingNodes_CLIENT(_activeUnit, unitID, movePath);

            NetWorkManager.NetworkAgent.CmdTellServerToMoveUnit(PlayerManager.PlayerAgent.NetID, _activeUnit.NetID, pathInts);
        }
    }
    // this is now being done on sevrer and return a list of vector3 to make node visual display for path for client
    public int[] SetUnitsPath(GameObject objToMove, Vector3 start, Vector3 end)
    {
        unitsToMove.Add(objToMove);

        UnitScript unitScript = objToMove.GetComponent <UnitScript> ();

        List <CubeLocationScript> path = _pathFinding.FindPath(unitScript, start, end);

        objToMove.GetComponent <MovementScript>().MoveUnit(path);
        List <Vector3> vects = _dataManipulation.GetLocVectorsFromCubeScript(path);

        int[] movePath = _dataManipulation.ConvertVectorsIntoIntArray(vects);
        return(movePath);
    }