本文整理汇总了C#中VectorLine.SetColors方法的典型用法代码示例。如果您正苦于以下问题:C# VectorLine.SetColors方法的具体用法?C# VectorLine.SetColors怎么用?C# VectorLine.SetColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorLine
的用法示例。
在下文中一共展示了VectorLine.SetColors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowMoveTrek
void ShowMoveTrek()
{
if (ShipType != eShipType.Enemy)//仅敌人显示轨迹
return;
if (Speed.magnitude < float.Epsilon)
return;
Vector3 targetPos = new Vector3 (Speed.x,Speed.y,0);
targetPos.Normalize ();
if (FireLine == null) {
Vector3 [] _points = new Vector3[6];
for(int i=0;i<6;++i)
{
_points[i]=new Vector3(pMain.AimLineScale*0.1f*i,0,0);
}
Color [] _color = new Color[5];
_color[0] = Color.red;
_color[1] = Color.yellow;
_color[2] = Color.green;
_color[3] = Color.blue;
_color[4] = Color.red;
FireLine = VectorLine.SetLine(Color.white,_points);
FireLine.smoothColor = true;
FireLine.SetColors(_color);
VectorManager.ObjectSetup(FirePoint,FireLine,Visibility.Always, Brightness.None);
}
float direct = Mathf.Acos (targetPos.x);
direct = direct/Mathf.PI * 180;
if (targetPos.y < 0)
direct = 360-direct;
FirePoint.transform.localPosition = new Vector3 (0, 0, 0);
FirePoint.transform.rotation = Quaternion.Euler(new Vector3(0,0,direct));
}
示例2: OnChangeDirection
public void OnChangeDirection()
{
if (ShipType == eShipType.Enemy)//以下代码给PlayerShip使用
return;
if (!FirePoint.activeInHierarchy)
return;
if (ShotDirX.text == "" || ShotDirY.text == "")
return;
Vector3 targetPos = new Vector3 (int.Parse(ShotDirX.text),int.Parse(ShotDirY.text),0);
//如果是相对瞄准,不进行这步
if (WeaponSystem.getInstance().bAimType_Abs)
{
targetPos -= transform.position;
}
targetPos.Normalize ();
if (FireLine == null) {
Vector3 [] _points = new Vector3[6];
for(int i=0;i<6;++i)
{
_points[i]=new Vector3(pMain.AimLineScale*0.1f*i,0,0);
}
Color [] _color = new Color[5];
_color[0] = Color.red;
_color[1] = Color.yellow;
_color[2] = Color.green;
_color[3] = Color.blue;
_color[4] = Color.red;
FireLine = VectorLine.SetLine(Color.white,_points);
FireLine.smoothColor = true;
FireLine.SetColors(_color);
VectorManager.ObjectSetup(FirePoint,FireLine,Visibility.Always, Brightness.None);
}
float direct = Mathf.Acos (targetPos.x);
direct = direct/Mathf.PI * 180;
if (targetPos.y < 0)
direct = 360-direct;
FirePoint.transform.rotation = Quaternion.Euler(new Vector3(0,0,direct));
//FirePoint.transform.rotation = Quaternion.Euler (0,0,90);
}
示例3: OnEnemyRespawn
public void OnEnemyRespawn()
{
Vector3 targetPos = new Vector3(Speed.x, Speed.y, 0);
//targetPos -= transform.position;
targetPos.Normalize();
if (FireLine == null)
{
Vector3[] _points = new Vector3[6];
for (int i = 0; i < 6; ++i)
{
_points[i] = new Vector3(pMain.AimLineScale * 0.1f * i, 0, 0);
}
Color[] _color = new Color[5];
_color[0] = Color.red;
_color[1] = Color.yellow;
_color[2] = Color.green;
_color[3] = Color.blue;
_color[4] = Color.red;
FireLine = VectorLine.SetLine(Color.white, _points);
FireLine.smoothColor = true;
FireLine.SetColors(_color);
VectorManager.ObjectSetup(FirePoint, FireLine, Visibility.Always, Brightness.None);
}
float direct = Mathf.Acos(targetPos.x);
direct = direct / Mathf.PI * 180;
if (targetPos.y < 0)
direct = 360 - direct;
FirePoint.transform.rotation = Quaternion.Euler(new Vector3(0, 0, direct));
//FirePoint.transform.rotation = Quaternion.Euler (0,0,90);
}