Ejemplo n.º 1
0
    public void EditUnit()
    {
        if (AI.Unit == null)
        {
            AI.Unit = AI.GetComponent <Unit> ();
        }

        #region Edit Unit
        EnableEditUnit = EditorGUILayout.BeginToggleGroup("Edit Unit : " + AI.Unit.Name, EnableEditUnit);
        if (EnableEditUnit)
        {
            //EditBasicUnitProperty ();
            AI.Unit = (Unit)EditorCommon.EditBasicUnitProperty(AI.Unit);
            //Edit Start AI
            AbstractAI[] AllAI = AI.gameObject.GetComponents <AbstractAI> ();
            AI.Unit.StartAIName = EditorCommon.EditPopup("Unit Start AI:", AI.Unit.StartAIName, AllAI.Select(x => x.Name).ToArray());
            //Edit Idle Data
            if (EnableEditIdleData = EditorGUILayout.BeginToggleGroup("---Edit Idle Data", EnableEditIdleData))
            {
                AI.Unit.IdleData = EditorCommon.EditIdleDataArray(AI.Unit.gameObject,
                                                                  AI.Unit.IdleData);
            }
            EditorGUILayout.EndToggleGroup();

            //Edit rotate data
            if (EnableEditRotateData = EditorGUILayout.BeginToggleGroup("---Edit Rotate Data", EnableEditRotateData))
            {
                AI.Unit.RotateData = EditorCommon.EditRotateDataArray(AI.Unit.gameObject,
                                                                      AI.Unit.RotateData);
            }
            EditorGUILayout.EndToggleGroup();

            //Edit Move Data
            if (EnableEditMoveData = EditorGUILayout.BeginToggleGroup("---Edit Move Data", EnableEditMoveData))
            {
                AI.Unit.MoveData = EditorCommon.EditMoveDataArray(AI.Unit.gameObject,
                                                                  AI.Unit.MoveData);
            }
            EditorGUILayout.EndToggleGroup();

            //Edit attack data
            if (EnableEditAttackData = EditorGUILayout.BeginToggleGroup("---Edit Attack Data---", EnableEditAttackData))
            {
                AI.Unit.AttackData = EditorCommon.EditAttackDataArray(AI.Unit,
                                                                      AI.Unit.AttackData);
            }
            EditorGUILayout.EndToggleGroup();



            //Edit Effect Data
            if (EnableEditEffectData = EditorGUILayout.BeginToggleGroup("---Edit Effect Data---", EnableEditEffectData))
            {
                AI.Unit.EffectData = EditorCommon.EditEffectData(AI.Unit.EffectData);
            }
            EditorGUILayout.EndToggleGroup();

            //Edit Decal data
            if (EnableEditDecalData = EditorGUILayout.BeginToggleGroup("---Edit Decal Data---", EnableEditDecalData))
            {
                AI.Unit.DecalData = EditorCommon.EditDecalData(AI.Unit.DecalData);
            }
            EditorGUILayout.EndToggleGroup();
            //Edit receive damage data:
            if (EnableEditReceiveDamageData = EditorGUILayout.BeginToggleGroup("---Edit ReceiveDamage Data---", EnableEditReceiveDamageData))
            {
                AI.Unit.ReceiveDamageData = EditorCommon.EditReceiveDamageData(AI.Unit,
                                                                               AI.Unit.ReceiveDamageData);
            }
            EditorGUILayout.EndToggleGroup();


            //Edit death data
            if (EnableEditDeathData = EditorGUILayout.BeginToggleGroup("---Edit Death Data---", EnableEditDeathData))
            {
                AI.Unit.DeathData = EditorCommon.EditDeathData(AI.Unit, AI.Unit.DeathData);
            }
            EditorGUILayout.EndToggleGroup();

            //Edit audio data
            if (EnableEditAudioData = EditorGUILayout.BeginToggleGroup("---Edit Audio Data---", EnableEditAudioData))
            {
                AI.Unit.AudioData = EditorCommon.EditAudioData(AI.Unit, AI.Unit.AudioData);
            }
            EditorGUILayout.EndToggleGroup();
        }
        EditorGUILayout.EndToggleGroup();
        #endregion
    }