Beispiel #1
0
 private void Awake()
 {
     attribute    = GetComponent <NpcAttribute>();
     ai           = new TowerCharacter();
     ai.attribute = attribute;
     ai.AddState(new TowerIdle());
     ai.AddState(new TowerAttack());
     ai.AddState(new TowerDead());
 }
    void DrawTowerLazerSetting(TowerCharacter tower)
    {
        GUILayout.Label("Custom Barrier Tower", EditorStyles.boldLabel);
        GUILayout.Space(5f);
        tower.prefab = SetObject("BaseModel", tower.prefab);

        GUILayout.Space(5f);
        tower.towername = EditorGUILayout.TextField("Tower Name", tower.towername);

        GUILayout.Space(5f);
        tower.rangeRadius = SetFloat("RangeRadius", tower.rangeRadius);

        GUILayout.Space(5f);
        tower.turnSpeed = SetFloat("TurnSpeed", tower.turnSpeed);


        GUILayout.Space(5f);
        tower.mesh = SetObject("Mesh", tower.mesh);


        GUILayout.Space(5f);
        tower.upgradeEffect = SetObject("UpgradeEffect", tower.upgradeEffect);

        GUILayout.Space(5f);
        tower.upGradeMat = setMaterial("UpGradeMat", tower.upGradeMat);

        GUILayout.Space(5f);
        tower.lazerEffect = SetObject("LazerEffect", tower.lazerEffect);

        GUILayout.Space(5f);
        tower.damageOverTime = SetFloat("DamageOver", tower.damageOverTime);

        GUILayout.Space(5f);
        tower.slowAmount = SetFloat("SlowAmount", tower.slowAmount);


        GUILayout.Space(10f);
        if (tower.prefab == null)
        {
            EditorGUILayout.HelpBox("This tower needs a [BaseModel] before it can be created.", MessageType.Warning);
        }
        else if (tower.towername == null || tower.towername.Length < 1)
        {
            EditorGUILayout.HelpBox("This tower needs a [Name] before it can be created.", MessageType.Warning);
        }
        else if (GUILayout.Button("SAVE", GUILayout.Height(30)))
        {
            SaveData();
            window.Close();
        }
    }