当前位置: 首页>>代码示例>>C#>>正文


C# Vector3.ToString方法代码示例

本文整理汇总了C#中System.Vector3.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.ToString方法的具体用法?C# Vector3.ToString怎么用?C# Vector3.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Vector3的用法示例。


在下文中一共展示了Vector3.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveTo

        /// <summary>
        /// Moves to a world position 
        /// (naive, blocks execution, avoid using while in combat)
        /// </summary>
        /// <param name="location">where to move to</param>
        /// <param name="destinationName">name of location for debugging purposes</param>
        /// <param name="range">how close it should get</param>
        public static async Task<bool> MoveTo(Vector3 location, string destinationName = "", float range = 10f, Func<bool> stopCondition = null)
        {
            var distance = 0f;
            var name = string.IsNullOrEmpty(destinationName) ? location.ToString() : destinationName;

            Navigator.PlayerMover.MoveTowards(location);

            while (ZetaDia.IsInGame && (distance = location.Distance(ZetaDia.Me.Position)) >= range)
            {
                if (stopCondition != null && stopCondition())
                    break;

                if (ZetaDia.Me.IsDead || Navigator.StuckHandler.IsStuck)
                    break;

                if (Navigation.IsBlocked)
                {
                    Log.Verbose("Movement Failed, It looks like we're blocked!", name, distance);
                    break;
                }
                    
                Log.Verbose("Moving to {0} Distance={1}", name, distance);
                await Navigator.MoveTo(location, name);
                await Coroutine.Yield();
            }

            if (distance <= range)
                Navigator.PlayerMover.MoveStop();

            Log.Verbose("MoveTo Finished. Distance={0}", distance);
            return true;
        }
开发者ID:dachidahu,项目名称:AutoFollow,代码行数:39,代码来源:Movement.cs

示例2: CacheName

 public string CacheName(Vector3 addr)
 {
     byte[] data = UnicodeEncoding.Unicode.GetBytes(addr.ToString() + m_map.Name);
     byte[] hash = new SHA1CryptoServiceProvider().ComputeHash(data);
     StringBuilder hex = new StringBuilder(hash.Length);
     foreach (byte b in data)
     {
         hex.Append(b.ToString("X2"));
     }
     return hex.ToString();
 }
开发者ID:eropple,项目名称:sharplike,代码行数:11,代码来源:AbstractCachingAlgorithm.cs

示例3: Main

        static void Main(string[] args)
        {
            //3d vectors are necessary, because crossproduct creates a 
            //perpendicular vector, which doesnt exist in 2d space
            Vector3 a = new Vector3(1f, 1f, 0f);
            Vector3 b = new Vector3(3f, 1f, 0f);
            Vector3 c = new Vector3(2f, 3f, 0f);

            Vector3 x = new Vector3(2f, 2f, 0f);

            bool result = PointInTriangle(x, a, b, c);

            if (result)
            {
                Console.WriteLine("{0}is in triangle", x.ToString());
            }
            else
            {
                Console.WriteLine("{0}is NOT in triangle", x.ToString());
            }
        }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:21,代码来源:Program.cs

示例4: teleport

        public void teleport(string sim,Vector3 pos)
        {
            Gtk.Application.Invoke(delegate {
                this.label_sim.Text=sim;
                this.label_loc.Text=pos.ToString();
                this.tppos=pos;
                this.tpsim=sim;
                this.QueueDraw();
            });

                Thread tpRunner= new Thread(new ThreadStart(this.tpthread));
                tpRunner.Start();
        }
开发者ID:robincornelius,项目名称:omvviewer-light,代码行数:13,代码来源:TeleportProgress.cs

示例5: PositionToString

 public String PositionToString(Vector3 p)
 {
     return p.ToString();
 }
开发者ID:Keldyn,项目名称:BattleOfTheClans,代码行数:4,代码来源:LuaAPI.cs

示例6: Wake

 public AbstractPage Wake(Vector3 addr)
 {
     Console.WriteLine("Waking " + addr.ToString());
     string path = Game.PathTo("cache/" + CacheName(addr) + ".dat");
     FileStream file = new FileStream(path, FileMode.Open);
     BinaryFormatter f = new BinaryFormatter();
     AbstractPage page = (AbstractPage)f.Deserialize(file);
     file.Close();
     File.Delete(path);
     return page;
 }
开发者ID:eropple,项目名称:sharplike,代码行数:11,代码来源:AbstractCachingAlgorithm.cs

示例7: QueryAccess

        /// <summary>
        /// </summary>
        public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
        {
            reason = "Failed to contact destination";
            version = "Unknown";

            // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);

            IPEndPoint ext = destination.ExternalEndPoint;
            if (ext == null) return false;

            // Eventually, we want to use a caps url instead of the agentID
            string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";

            OSDMap request = new OSDMap();
            request.Add("position", OSD.FromString(position.ToString()));

            try
            {
                OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000, false);
                bool success = result["success"].AsBoolean();
                if (result.ContainsKey("_Result"))
                {
                    OSDMap data = (OSDMap)result["_Result"];

                    reason = data["reason"].AsString();
                    if (data["version"] != null && data["version"].AsString() != string.Empty)
                        version = data["version"].AsString();

                    m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString());
                }

                if (!success)
                {
                    if (result.ContainsKey("Message"))
                    {
                        string message = result["Message"].AsString();
                        if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
                        {
                            m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
                            return true;
                        }

                        reason = result["Message"];
                    }
                    else
                    {
                        reason = "Communications failure";
                    }

                    return false;
                }

                return success;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcess failed with exception; {0}",e.ToString());
            }
            
            return false;
        }
开发者ID:JAllard,项目名称:osmodified,代码行数:63,代码来源:SimulationServiceConnector.cs

示例8: UnstuckHandler

        // Actually deal with a stuck - find an unstuck point etc.
        public static Vector3 UnstuckHandler(Vector3 vMyCurrentPosition, Vector3 vOriginalDestination)
        {
            if (Trinity.Settings.Advanced.DisableAllMovement)
                return Vector3.Zero;

            // Update the last time we generated a path
            LastGeneratedStuckPosition = DateTime.UtcNow;
            Navigator.Clear();

            // If we got stuck on a 2nd/3rd/4th "chained" anti-stuck route, then return the old move to target to keep movement of some kind going
            if (TimesReachedStuckPoint > 0)
            {
                vSafeMovementLocation = Vector3.Zero;

                // Reset the path and allow a whole "New" unstuck generation next cycle
                TimesReachedStuckPoint = 0;
                // And cancel unstucking for 9 seconds so DB can try to navigate
                CancelUnstuckerForSeconds = (9 * TotalAntiStuckAttempts);
                if (CancelUnstuckerForSeconds < 20)
                    CancelUnstuckerForSeconds = 20;
                LastCancelledUnstucker = DateTime.UtcNow;
                Logger.Log(TrinityLogLevel.Verbose, LogCategory.UserInformation, "Clearing old route and trying new path find to: " + LastMoveToTarget.ToString());
                NavigateTo(LastMoveToTarget, "original destination");
                return vSafeMovementLocation;
            }
            // Only try an unstuck 10 times maximum in XXX period of time
            if (Vector3.Distance(vOriginalDestination, vMyCurrentPosition) >= V.F("Unstucker.MaxDistance"))
            {
                Logger.Log(TrinityLogLevel.Verbose, LogCategory.UserInformation, "You are " + Vector3.Distance(vOriginalDestination, vMyCurrentPosition).ToString() + " distance away from your destination.");
                Logger.Log(TrinityLogLevel.Verbose, LogCategory.UserInformation, "This is too far for the unstucker, and is likely a sign of ending up in the wrong map zone.");
                TotalAntiStuckAttempts = 20;
            }

            if (TotalAntiStuckAttempts <= 10)
            {
                Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "Your bot got stuck! Trying to unstuck (attempt #{0} of 10 attempts) {1} {2} {3} {4}",
                    TotalAntiStuckAttempts.ToString(),
                    "Act=\"" + ZetaDia.CurrentAct + "\"",
                    "questId=\"" + ZetaDia.CurrentQuest.QuestSNO + "\"",
                    "stepId=\"" + ZetaDia.CurrentQuest.StepId + "\"",
                    "worldId=\"" + ZetaDia.CurrentWorldId + "\""
                );

                Logger.Log(TrinityLogLevel.Verbose, LogCategory.UserInformation, "(destination=" + vOriginalDestination.ToString() + ", which is " + Vector3.Distance(vOriginalDestination, vMyCurrentPosition).ToString() + " distance away)");

                /*
                 * Unstucker position
                 */
                //vSafeMovementLocation = NavHelper.FindSafeZone(true, TotalAntiStuckAttempts, vMyCurrentPosition);
                vSafeMovementLocation = NavHelper.SimpleUnstucker();

                // Temporarily log stuff
                if (TotalAntiStuckAttempts == 1 && Trinity.Settings.Advanced.LogStuckLocation)
                {
                    FileStream LogStream = File.Open(Path.Combine(FileManager.LoggingPath, "Stucks - " + Trinity.Player.ActorClass.ToString() + ".log"), FileMode.Append, FileAccess.Write, FileShare.Read);
                    using (StreamWriter LogWriter = new StreamWriter(LogStream))
                    {
                        LogWriter.WriteLine(DateTime.UtcNow.ToString() + ": Original Destination=" + LastMoveToTarget.ToString() + ". Current player position when stuck=" + vMyCurrentPosition.ToString());
                        LogWriter.WriteLine("Profile Name=" + ProfileManager.CurrentProfile.Name);
                    }
                    LogStream.Close();
                }
                // Now count up our stuck attempt generations
                TotalAntiStuckAttempts++;
                return vSafeMovementLocation;
            }

            TimesReachedMaxUnstucks++;
            TotalAntiStuckAttempts = 1;
            vSafeMovementLocation = Vector3.Zero;
            LastPosition = Vector3.Zero;
            TimesReachedStuckPoint = 0;
            TimeLastRecordedPosition = DateTime.MinValue;
            LastGeneratedStuckPosition = DateTime.MinValue;
            // int iSafetyLoops = 0;
            if (TimesReachedMaxUnstucks == 1)
            {
                Navigator.Clear();
                GridSegmentation.Reset();
                Logger.Log(TrinityLogLevel.Info, LogCategory.Movement, "Anti-stuck measures now attempting to kickstart DB's path-finder into action.");
                var result = NavigateTo(vOriginalDestination, "original destination");
                //Navigator.MoveTo(vOriginalDestination, "original destination");
                CancelUnstuckerForSeconds = 40;
                LastCancelledUnstucker = DateTime.UtcNow;
                return vSafeMovementLocation;
            }
            if (TimesReachedMaxUnstucks == 2)
            {
                Logger.Log(TrinityLogLevel.Info, LogCategory.Movement, "Anti-stuck measures failed. Now attempting to reload current profile.");

                Navigator.Clear();

                ProfileManager.Load(Zeta.Bot.ProfileManager.CurrentProfile.Path);
                Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "Anti-stuck successfully reloaded current profile, DemonBuddy now navigating again.");
                return vSafeMovementLocation;

                // Didn't make it to town, so skip instantly to the exit game system
                //iTimesReachedMaxUnstucks = 3;
            }
//.........这里部分代码省略.........
开发者ID:FalseApple,项目名称:d3db,代码行数:101,代码来源:PlayerMover.cs

示例9: WarnAndLogLongPath

 private static Vector3 WarnAndLogLongPath(Vector3 vMoveToTarget)
 {
     // The below code is to help profile/routine makers avoid waypoints with a long distance between them.
     // Long-distances between waypoints is bad - it increases stucks, and forces the DB nav-server to be called.
     if (Trinity.Settings.Advanced.LogStuckLocation)
     {
         if (vLastMoveTo == Vector3.Zero)
             vLastMoveTo = vMoveToTarget;
         if (vMoveToTarget != vLastMoveTo)
         {
             float fDistance = Vector3.Distance(vMoveToTarget, vLastMoveTo);
             // Log if not in town, last waypoint wasn't FROM town, and the distance is >200 but <2000 (cos 2000+ probably means we changed map zones!)
             if (!Trinity.Player.IsInTown && !bLastWaypointWasTown && fDistance >= 200 & fDistance <= 2000)
             {
                 if (!hashDoneThisVector.Contains(vMoveToTarget))
                 {
                     // Log it
                     FileStream LogStream = File.Open(Path.Combine(FileManager.LoggingPath, "LongPaths - " + ZetaDia.Me.ActorClass.ToString() + ".log"), FileMode.Append, FileAccess.Write, FileShare.Read);
                     using (StreamWriter LogWriter = new StreamWriter(LogStream))
                     {
                         LogWriter.WriteLine(DateTime.UtcNow.ToString() + ":");
                         LogWriter.WriteLine("Profile Name=" + ProfileManager.CurrentProfile.Name);
                         LogWriter.WriteLine("'From' Waypoint=" + vLastMoveTo.ToString() + ". 'To' Waypoint=" + vMoveToTarget.ToString() + ". Distance=" + fDistance.ToString());
                     }
                     LogStream.Close();
                     hashDoneThisVector.Add(vMoveToTarget);
                 }
             }
             vLastMoveTo = vMoveToTarget;
             bLastWaypointWasTown = false;
             if (Trinity.Player.IsInTown)
                 bLastWaypointWasTown = true;
         }
     }
     return vMoveToTarget;
 }
开发者ID:FalseApple,项目名称:d3db,代码行数:36,代码来源:PlayerMover.cs

示例10: SetGroupPosition

        // Internal function that has all the logic but also allows the operation to be forced (even if in transit)
        public bool SetGroupPosition(Vector3 value, bool forced, bool physicsTriggered)
        {
            if ((!forced) && (ParentGroup != null) && ParentGroup.InTransit) // it's null at startup time
            {
                m_log.WarnFormat("[SCENEOBJECTPART]: GroupPosition update for {0} to {1} ignored while in transit.", ParentGroup.Name, value.ToString());
                return false;
            }

            //check for nan and inf for x y and z.  refuse to set position
            //in these cases
            if (Single.IsNaN(value.X) || Single.IsInfinity(value.X) ||
                Single.IsNaN(value.Y) || Single.IsInfinity(value.Y) ||
                Single.IsNaN(value.Z) || Single.IsInfinity(value.Z))
            {
                return false;
            }

            SetGroupPositionDirect(value);

            if (!physicsTriggered)
            {
                PhysicsActor physActor = PhysActor;
                if (physActor != null)
                {
                    try
                    {
                        // Root prim actually goes at Position
                        if (IsRootPart())
                        {
                            physActor.Position = value;
                        }
                    }
                    catch (Exception e)
                    {
                        m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
                    }
                }
            }

            return true;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:42,代码来源:SceneObjectPart.cs

示例11: UpdateSession

        private bool UpdateSession(UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
        {
            // Save our current location as session data
            NameValueCollection requestArgs = new NameValueCollection
                {
                        { "RequestMethod", "UpdateSession" },
                        { "SessionID", sessionID.ToString() },
                        { "SceneID", regionID.ToString() },
                        { "ScenePosition", lastPosition.ToString() },
                        { "SceneLookAt", lastLookAt.ToString() }
                };

            OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
            bool success = response["Success"].AsBoolean();

            if (!success)
                m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to update agent session " + sessionID + ": " + response["Message"].AsString());

            return success;
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:20,代码来源:SimianPresenceServiceConnector.cs

示例12: CreateMesh

        public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
        {
#if SPAM
            m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);
#endif

            Mesh mesh = null;
            ulong key = 0;

            // If this mesh has been created already, return it instead of creating another copy
            // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
            key = GetMeshKey(primShape, size, lod);
            if (m_uniqueMeshes.TryGetValue(key, out mesh))
                return mesh;

            if (size.X < 0.01f) size.X = 0.01f;
            if (size.Y < 0.01f) size.Y = 0.01f;
            if (size.Z < 0.01f) size.Z = 0.01f;

            mesh = CreateMeshFromPrimMesher(primName, primShape, size, lod);

            if (mesh != null)
            {
                if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
                {
#if SPAM
                m_log.Debug("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + 
                            minSizeForComplexMesh.ToString() + " - creating simple bounding box");
#endif
                    mesh = CreateBoundingBoxMesh(mesh);
                    mesh.DumpRaw(baseDir, primName, "Z extruded");
                }

                // trim the vertex and triangle lists to free up memory
                mesh.TrimExcess();

                m_uniqueMeshes.Add(key, mesh);
            }

            return mesh;
        }
开发者ID:HGExchange,项目名称:opensim,代码行数:41,代码来源:Meshmerizer.cs

示例13: llRequestInventoryData

        public LSL_Key llRequestInventoryData(string name)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            

            TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();

            foreach (TaskInventoryItem item in itemDictionary.Values)
            {
                if (item.Type == 3 && item.Name == name)
                {
                    DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver");

                    UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID,
                                                     m_itemID, item.AssetID.ToString());

                    Vector3 region = new Vector3(
                        World.RegionInfo.RegionLocX,
                        World.RegionInfo.RegionLocY,
                        0);

                    World.AssetService.Get(item.AssetID.ToString(), this,
                        delegate(string i, object sender, AssetBase a)
                        {
                            AssetLandmark lm = new AssetLandmark(a);

                            float rx = (uint)(lm.RegionHandle >> 32);
                            float ry = (uint)lm.RegionHandle;
                            region = lm.Position + new Vector3(rx, ry, 0) - region;

                            string reply = region.ToString();
                            dataserverPlugin.AddReply(i.ToString(),
                                                             reply, 1000);
                        });

                    ScriptSleep(1000);
                    return (LSL_Key)tid.ToString();                   
                }
            }
            ScriptSleep(1000);
            return (LSL_Key) String.Empty;
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:42,代码来源:LSL_Api.cs

示例14: SpawnCargoShipGroup

        public void SpawnCargoShipGroup(Vector3 startPosition, Vector3 stopPosition, ulong remoteUserId = 0)
        {
            try
            {
                //Load the spawn groups
                SpawnGroupsDefinitionsManager spawnGroupsDefinitionsManager = new SpawnGroupsDefinitionsManager();
                FileInfo contentDataFile = new FileInfo(Path.Combine(MyFileSystem.ContentPath, "Data", "SpawnGroups.sbc"));
                spawnGroupsDefinitionsManager.Load(contentDataFile);

                //Calculate lowest and highest frequencies
                float lowestFrequency = 999999;
                float highestFrequency = 0;
                foreach (SpawnGroupDefinition entry in spawnGroupsDefinitionsManager.Definitions)
                {
                    if (entry.Frequency < lowestFrequency)
                        lowestFrequency = entry.Frequency;
                    if (entry.Frequency > highestFrequency)
                        highestFrequency = entry.Frequency;
                }
                if (lowestFrequency <= 0)
                    lowestFrequency = 1;

                //Get a list of which groups *could* spawn
                Random random = new Random((int)DateTime.Now.ToBinary());
                double randomChance = random.NextDouble();
                randomChance = randomChance * (highestFrequency / lowestFrequency);
                List<SpawnGroupDefinition> possibleGroups = new List<SpawnGroupDefinition>();
                foreach (SpawnGroupDefinition entry in spawnGroupsDefinitionsManager.Definitions)
                {
                    if (entry.Frequency >= randomChance)
                    {
                        possibleGroups.Add(entry);
                    }
                }

                //Determine which group *will* spawn
                randomChance = random.NextDouble();
                int randomShipIndex = Math.Max(0, Math.Min((int)Math.Round(randomChance * possibleGroups.Count, 0), possibleGroups.Count-1));
                SpawnGroupDefinition randomSpawnGroup = possibleGroups[randomShipIndex];

                ChatManager.Instance.SendPrivateChatMessage(remoteUserId, "Spawning cargo group '" + randomSpawnGroup.Name + "' ...");

                //Spawn the ships in the group
                Matrix orientation = Matrix.CreateLookAt(startPosition, stopPosition, new Vector3(0, 1, 0));
                foreach (SpawnGroupPrefab entry in randomSpawnGroup.Prefabs)
                {
                    FileInfo prefabFile = new FileInfo(Path.Combine(MyFileSystem.ContentPath, "Data", "Prefabs", entry.SubtypeId + ".sbc"));
                    if (!prefabFile.Exists)
                        continue;

                    //Create the ship
                    CubeGridEntity cubeGrid = new CubeGridEntity(prefabFile);

                    //Set the ship position and orientation
                    Vector3 shipPosition = Vector3.Transform(entry.Position, orientation) + startPosition;
                    orientation.Translation = shipPosition;
                    MyPositionAndOrientation newPositionOrientation = new MyPositionAndOrientation(orientation);
                    cubeGrid.PositionAndOrientation = newPositionOrientation;

                    //Set the ship velocity
                    //Speed is clamped between 1.0f and the max cube grid speed
                    Vector3 travelVector = stopPosition - startPosition;
                    travelVector.Normalize();
                    Vector3 shipVelocity = travelVector * (float)Math.Min(cubeGrid.MaxLinearVelocity, Math.Max(1.0f, entry.Speed));
                    cubeGrid.LinearVelocity = shipVelocity;

                    cubeGrid.IsDampenersEnabled = false;

                    foreach (MyObjectBuilder_CubeBlock cubeBlock in cubeGrid.BaseCubeBlocks)
                    {
                        //Set the beacon names
                        if (cubeBlock.TypeId == typeof(MyObjectBuilder_Beacon))
                        {
                            MyObjectBuilder_Beacon beacon = (MyObjectBuilder_Beacon)cubeBlock;
                            beacon.CustomName = entry.BeaconText;
                        }

                        //Set the owner of every block
                        //TODO - Find out if setting to an arbitrary non-zero works for this
                        cubeBlock.Owner = PlayerMap.Instance.GetServerVirtualPlayerId();
                        cubeBlock.ShareMode = MyOwnershipShareModeEnum.Faction;
                    }

                    //And add the ship to the world
                    SectorObjectManager.Instance.AddEntity(cubeGrid);

                    //Force a refresh of the cube grid
                    List<CubeBlockEntity> cubeBlocks = cubeGrid.CubeBlocks;
                }

                ChatManager.Instance.SendPrivateChatMessage(remoteUserId, "Cargo group '" + randomSpawnGroup.DisplayName + "' spawned with " + randomSpawnGroup.Prefabs.Length.ToString() + " ships at " + startPosition.ToString());
            }
            catch (Exception ex)
            {
                LogManager.ErrorLog.WriteLine(ex);
            }
        }
开发者ID:Zaragoss,项目名称:SE-Community-Mod-API,代码行数:97,代码来源:CargoShipManager.cs

示例15: OnMouseDown

        protected override void OnMouseDown(object sender, MouseEventArgs e) {
            switch (e.Button) {
                case MouseButtons.Left:
                    _minimap.OnClick(e);
                    _lastMousePos = e.Location;
                    Window.Capture = true;
                    break;
                case MouseButtons.Right:
                    // move the unit around using the right clicks
                    var ray = _camera.GetPickingRay(new Vector2(e.X, e.Y), new Vector2(Viewport.Width, Viewport.Height));

                    var tile = new MapTile();
                    var worldPos = new Vector3();

                    // do intersection test
                    if (!_terrain.Intersect(ray, ref worldPos, ref tile)) {
                        return;
                    }
                    Console.WriteLine("Clicked at " + worldPos.ToString());
                    if (tile == null) {
                        return;
                    }
                    // move the unit towards the new goal
                    Console.WriteLine("Hit tile " + tile.MapPosition);
                    Console.WriteLine("Moving unit to " + tile.MapPosition);
                    _unit.Goto(tile);
                    break;
            }
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:29,代码来源:PathfindingDemo.cs


注:本文中的System.Vector3.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。