Example #1
0
 /// <summary>
 /// Hover event for Arrow.
 /// </summary>
 /// <param name="line">Line.</param>
 public void HoverOnArrow(int line)
 {
     foreach (GameObject obj in arrows)
     {
         WayCrossArrowClick wcac = obj.GetComponent <WayCrossArrowClick>();
         wcac.Highlight(wcac.tile.wayLine == line);
     }
 }
Example #2
0
    /// <summary>
    /// Creates the arrows.
    /// </summary>
    private void createArrows()
    {
        // arrow index
        int index = 0;

        // angle for the arrow
        float angle = 0;

        // find all adjacent tile, if way, place an arrow
        for (int i = 0; i < crossTile.adjacent.Length; i++)
        {
            TileNode tn = crossTile.adjacent[i];

            if (tn.type == TileNode.Type.Way)
            {
                // contiune down the line
                TileNode tnCountiune = tn.adjacent[i];

                // create an arrow object
                arrows[index] = Object.Instantiate(Resources.Load("Prefabs/GameObject/WayCrossArrow")) as GameObject;

                // transform
                arrows[index].transform.position = new Vector3(tnCountiune.gameObject.transform.position.x, 50f, tnCountiune.gameObject.transform.position.z);
                arrows[index].transform.RotateAround(arrows[index].transform.position, Vector3.up, angle);

                // script varibles
                WayCrossArrowClick wcac = arrows[index].GetComponent <WayCrossArrowClick>();
                wcac.picker = this;
                wcac.tile   = tnCountiune;

                index++;
            }

            angle += 60f;
        }

        // index should always be 4 on a proper cross section
        Debug.Assert(index == 4);
    }