//提取Mouse信息,添加到mouseInfo并返回 MouseInfo AddmouseInfo() { MouseInfo mInfo = new MouseInfo(); mInfo.screenLoc = Input.mousePosition; mInfo.loc = Utils.mouseLoc; //获取Z=0时的鼠标位置 mInfo.ray = Utils.mouseRay; //通过鼠标光标从MainCamera获取光束 mInfo.time = Time.time; mInfo.Raycast(); //默认值为未加工的raycast //如果是第一个mouseInfo if (mouseInfos.Count == 0) { mouseInfos.Add(mInfo); //为mouseInfos添加mInfo } else { float lastTime = mouseInfos[mouseInfos.Count - 1].time; //当最后一个mouseInfo超时 if (mInfo.time != lastTime) { mouseInfos.Add(mInfo); //为mouseInfos添加mInfo } //在一个结构中AddMouseInfo()可能被调用两次,故需要时间测试 } return(mInfo); }
//Pulls info about the Mouse, adds it to mouseinfos, and return it MouseInfo AddMouseInfo() { MouseInfo mInfo = new MouseInfo(); mInfo.screenLoc = Input.mousePosition; mInfo.loc = Utils.mouseLoc; //Get pos of mouse at z=0 mInfo.ray = Utils.mouseRay; //Gets the ray frmo the Main Camera through the mosue pointer mInfo.time = Time.time; mInfo.Raycast(); //Default is to raycast with no mask if (mouseInfos.Count == 0) { //IF this is the first mouseInfo mouseInfos.Add(mInfo); //Add mInfo to mouseinfos } else { float lastTime = mouseInfos[mouseInfos.Count - 1].time; if (mInfo.time != lastTime) { //if time has passed since the last mouseInfo mouseInfos.Add(mInfo); //Add mInfo to mouseInfos } //This time test is necessary because ADdMouseInfo() could be called twice in one frame } return(mInfo); // Return mInfo as well }
MouseInfo AddMouseInfo() { MouseInfo mInfo = new MouseInfo(); mInfo.screenLoc = Input.mousePosition; mInfo.loc = Utils.mouseLoc; mInfo.ray = Utils.mouseRay; mInfo.time = Time.time; mInfo.Raycast(); if (mouseInfos.Count == 0) { mouseInfos.Add(mInfo); } else { float lastTime = mouseInfos[mouseInfos.Count - 1].time; if (mInfo.time != lastTime) { mouseInfos.Add(mInfo); } } return(mInfo); }
// Закидывает инфу о мышке, добавляет её список и возвращает MouseInfo AddMouseInfo() { MouseInfo mInfo = new MouseInfo(); mInfo.screenLoc = Input.mousePosition; mInfo.loc = Utils.mouseLoc; // Получаем позицию мышки в z = 0 mInfo.ray = Utils.mouseRay; // Кастуем луч из Main Camera через точку мышки mInfo.time = Time.time; mInfo.Raycast(); // Базовый рэйкаст без маски if (mouseInfos.Count == 0) { // Это первый mouseInfo mouseInfos.Add(mInfo); // Добавляем новый элемент } else { float lastTime = mouseInfos[mouseInfos.Count - 1].time; if (mInfo.time != lastTime) // Защита от того чтобы одна и та же точка не добавилась дважды { mouseInfos.Add(mInfo); // Добавляем } } return(mInfo); }
public MouseInfo AddMouseInfo() { MouseInfo mInfo = new MouseInfo(); mInfo.screenLoc = Input.mousePosition; mInfo.loc = Utils.mouseLoc; // Gets the position of the mouse at z=0 mInfo.ray = Utils.mouseRay; // Gets the ray from the Camera through the mousePointer mInfo.time = Time.time; mInfo.Raycast(); if (mouseInfos.Count == 0) { //If this is the first mouseInfo mouseInfos.Add(mInfo); } else { float lastTime = mouseInfos[mouseInfos.Count - 1].time; if (mInfo.time != lastTime) { //if tim has passed since the last mouseInfo mouseInfos.Add(mInfo); } //This time test is necessary because AddMouseInfo() could be called twice in one frame } return(mInfo); }
private MouseInfo AddMouseInfo() { MouseInfo info = new MouseInfo { screenPos = Input.mousePosition, position = Utils.mouseLoc, ray = Utils.mouseRay, time = Time.time }; info.Raycast(); if (mouseInfoBuffer.Count == 0 || info.time != mouseInfoBuffer[mouseInfoBuffer.Count - 1].time) { mouseInfoBuffer.Add(info); } return(info); }
// Pulls info about the Mouse, adds it to mouseInfos, and returns it MouseInfo AddMouseInfo() { MouseInfo mInfo = new MouseInfo(); mInfo.screenLoc = Input.mousePosition; mInfo.loc = Utils.mouseLoc; // Gets the position of the mouse at z=0 mInfo.ray = Utils.mouseRay; // Gets the ray from the Main Camera through // the mouse pointer mInfo.time = Time.time; mInfo.Raycast(); // Default is to raycast with no mask if (mouseInfos.Count == 0) { // If this is the first mouseInfo mouseInfos.Add(mInfo); // Add mInfo to mouseInfos } else { float lastTime = mouseInfos[mouseInfos.Count - 1].time; if (mInfo.time != lastTime) { // if time has passed since the last mouseInfo mouseInfos.Add(mInfo); // Add mInfo to mouseInfos } // This time test is necessary because AddMouseInfo() could be // called twice in one frame } return (mInfo); // Return mInfo as well }