Beispiel #1
0
        private void DrawWind(Vector3 point, float windDot, ZoneEditable zone)
        {
            Gizmos.color = Color.white;

            Gizmos.DrawRay(point, Quaternion.Euler(new Vector3(0, windDot * 180, 0)) * Vector3.forward * 5f);

            Gizmos.color = zone.color;
        }
Beispiel #2
0
 private void RemoveDeletePointFromZone(ZoneEditable zone)
 {
     //Pour chaque points d'une zone
     if (zone.points.Count != 0)
     {
         for (int j = 0; j < zone.points.Count; j++)
         {
             //S'il n'est plus là
             if (zone.points[j] == null)
             {
                 zone.points.RemoveAt(j);
             }
         }
     }
 }
Beispiel #3
0
        public void AddZone()
        {
            ZoneEditable newZone = new ZoneEditable("Zone-" + editZones.Count);

            newZone.points = new List <Transform>();

            editZones.Add(newZone);

            zoneNbr = editZones.Count - 1;

            float size = 8;

            AddPoint(zoneNbr, new Vector2(-size, -size));
            AddPoint(zoneNbr, new Vector2(-size, size));
            AddPoint(zoneNbr, new Vector2(size, size));
            AddPoint(zoneNbr, new Vector2(size, -size));
        }
Beispiel #4
0
        private void DrawZone(ZoneEditable zone)
        {
            if (zone.points.Count != 0)
            {
                Gizmos.color = zone.color;

                Gizmos.DrawLine(zone.points[zone.points.Count - 1].position, zone.points[0].position);
                if (zone.drawWind)
                {
                    DrawWind(zone.points[zone.points.Count - 1].position, zone.windDir, zone);
                }
                for (int i = 0; i < zone.points.Count - 1; i++)
                {
                    Gizmos.DrawLine(zone.points[i].position, zone.points[i + 1].position);
                    if (zone.drawWind)
                    {
                        DrawWind(zone.points[i].position, zone.windDir, zone);
                    }
                }

                //Ce serait cool de générer un mesh et le draw
                //Gizmos.DrawMesh
            }
        }