예제 #1
0
파일: Test.cs 프로젝트: xdedss/BadappleGen
    //void DrawChain (EdgeChain chain)
    //{
    //    if (chain.next)
    //    {
    //        Debug.DrawLine(chain.pos.V3(0), chain.next.pos.V3(0), Color.green);
    //        DrawChain(chain.next);
    //    }
    //}

    public static void DrawLaserPath(List <LaserNode> path)
    {
        LaserNode last = null;

        //bool flip = true;
        foreach (var node in path)
        {
            if (last != null)
            {
                //flip ^= true;
                //float intensity = (last.intensity + node.intensity) / 4 + 0.5f;
                //Debug.DrawLine(last.pos.V3(0), node.pos.V3(0), new Color(flip?0:1, 1, 0, intensity));
                var col = last.color;
                col.a = Mathf.Clamp01(col.r + col.g + col.b) * 0.7f + 0.3f;
                Debug.DrawLine(last.pos.V3(0), node.pos.V3(0), col);
            }
            last = node;
        }
    }
예제 #2
0
    void CreateLaser(LaserNodePair pair)
    {
        LaserNode lasernode = pair.Node1.Laser;

        float dist = Vector3.Distance(pair.Node1.transform.position, pair.Node2.transform.position);

        Quaternion rot   = lasernode.transform.rotation;
        Vector3    pos   = lasernode.transform.position;
        Vector3    scale = new Vector3(1, 1, dist * (1 / SessionManager.Instance.WallNodeManagers[0].NodeWidth));

        lasernode.WarnLaser = Instantiate(WarnLaserPrefab);
        lasernode.WarnLaser.transform.rotation   = rot;
        lasernode.WarnLaser.transform.position   = pos;
        lasernode.WarnLaser.transform.parent     = lasernode.transform.parent;
        lasernode.WarnLaser.transform.localScale = scale;
        lasernode.WarnLaser.SetActive(false);

        lasernode.ActiveLaser = Instantiate(ActiveLaserPrefab);
        lasernode.ActiveLaser.transform.rotation   = rot;
        lasernode.ActiveLaser.transform.position   = pos;
        lasernode.ActiveLaser.transform.parent     = lasernode.transform.parent;
        lasernode.ActiveLaser.transform.localScale = scale;
        lasernode.ActiveLaser.SetActive(false);
    }
예제 #3
0
 public bool Equals(LaserNode other)
 {
     return(this.GetInstanceID() == other.GetInstanceID());
 }
예제 #4
0
 public void SendNode(LaserNode node)
 {
     byte[] bts = node.ToBytes(scale);
     SendBytes(bts);
     Debug.LogWarning("sending node");
 }
예제 #5
0
	public void AddNode(LaserNode node)
	{

	}
예제 #6
0
	void AddNode(LaserNode node)
	{
		Debug.Log("AddNode " + node.name + " to " + name);
		nodes.Add(node);
		node.TurnOn();
		TakeOverCrossedTeams();
		if (GameController.instance.isPlaying)
			GameController.instance.KeepMinimumNodes(team);
//		instrument.PlayNote(audioSource, nodes.Count);
		if (OnNodeTaken != null)
			OnNodeTaken(node, this);
	}
예제 #7
0
 void NewNode(LaserNode node)
 {
     currentData.Add(node);
     lastPoint = node.pos;
 }
예제 #8
0
	public List<LaserNode> IsCrossing(LaserNode nodeA, LaserNode nodeB)
	{
		List<LaserNode> res = new List<LaserNode>();
		if (nodeA == null || nodeB == null)
			return res;
		foreach(Team team in currentTeams)
		{
			if (team == nodeA.team)
				continue;
			foreach(LaserNode path in team.currentPaths)
			{
				for (int i = 0 ; i < path.nodes.Count - 1 ; i++)
				{
					if (path.nodes[i] == null || path.nodes[i+1] == null)
						continue;
					if (FasterLineSegmentIntersection(nodeA.position, nodeB.position, path.nodes[i].position, path.nodes[i+1].position))
					{
						res.Add(path);
						break;
					}
				}
			}
		}
		return res;
	}