private void CrateOneField(int i, int j, char symbol) { UserControl field; switch (symbol) { case MapSymbols.SymbolObstacle: field = new ObstacleControl(i, j); break; case MapSymbols.SymbolFreeField: field = new FreeFieldControl(i, j); break; case MapSymbols.SymbolStart: field = new StartControl(i, j); break; case MapSymbols.SymbolDestination: field = new DestinationControl(i, j); break; default: return; } field.SetValue(Grid.ColumnProperty, i); field.SetValue(Grid.RowProperty, j); MapControlGrid.Children.Add(field); }
// Use this for initialization void Start() { initY = transform.position.y; speedC = GameObject.Find("GvrMain").GetComponent <SpeedControl>(); obsC = GameObject.Find("GvrMain").GetComponent <ObstacleControl>(); moveC = GameObject.Find("GvrMain").GetComponent <MoveNew> (); }
// SerializedProperty ObstacleType; // // void OnEnable () // { // ObstacleType = serializedObject.FindProperty ("ObstacleType"); // } // // public override void OnInspectorGUI () // { // serializedObject.Update (); // EditorGUILayout.PropertyField (ObstacleType); // serializedObject.ApplyModifiedProperties (); //// if (ObstacleType == (target as ObstacleControl).Ob) { //// //// } // } public override void OnInspectorGUI() { ObstacleControl script = (ObstacleControl)target; script.ObstacleType = (ObstacleControl.Obstacle)EditorGUILayout.EnumPopup("Obstacle Type", script.ObstacleType); if (script.ObstacleType == ObstacleControl.Obstacle.Vortex) { script.vortexForce = EditorGUILayout.FloatField("Vortex Force", script.vortexForce); script.vortexDestroyDistance = EditorGUILayout.FloatField("Vortex Destroy Distance", script.vortexDestroyDistance); } }