예제 #1
0
    public override void OnInspectorGUI()
    {
        myTarget = (ShadowEffect)target;
        EditorUtility.SetDirty(myTarget);

        myTarget.SetPosition();
        myTarget.RestartShadow();

        GUILayout.Label("Wysokość obiektu");
        myTarget.objectHeight = EditorGUILayout.Slider(myTarget.objectHeight, 0.05f, 0.15f);
        GUILayout.Label("Moc cienia obiektu");
        myTarget.shadowIntensity             = (int)EditorGUILayout.Slider(myTarget.shadowIntensity, 0, 255);
        myTarget.shadowScale                 = EditorGUILayout.Vector3Field("", myTarget.shadowScale);
        myTarget.shadow.transform.localScale = myTarget.shadowScale;

        myTarget.shadow = (GameObject)EditorGUILayout.ObjectField(myTarget.shadow, typeof(GameObject), true);
    }
 /// <summary>
 /// Ustawia tekstury czołgu, jeśli nie podasz TankCapTexture to znaczy że dany czołg go nieposiada
 /// </summary>
 /// <param name="hullTexture">textura kadłuba czołgu</param>
 /// <param name="turretTexture">textura wieży lub lufy czołgu</param>
 /// <param name="turretCapTexture">textura zakrycia połączenia lufy z kadłubem u niszczycieli</param>
 /// <param name="hullLayer">order in layer hullTexture</param>
 /// <param name="turretLayer">order in layer turretTexture</param>
 /// <param name="turretCapLayer">order in layer turretCapTexture</param>
 void SetTankTexture(Sprite hullTexture, Sprite turretTexture = null, Sprite turretCapTexture = null,
                     int hullLayer = 12, int turretLayer = 14, int turretCapLayer = 15)
 {
     hull.GetComponent <SpriteRenderer>().sprite       = hullTexture;
     hull.GetComponent <SpriteRenderer>().sortingOrder = hullLayer;
     if (turretTexture != null)
     {
         turret.GetComponent <SpriteRenderer>().sprite       = turretTexture;
         turret.GetComponent <SpriteRenderer>().sortingOrder = turretLayer;
     }
     if (turretCapTexture != null)
     {
         turretCap.GetComponent <SpriteRenderer>().sprite       = turretCapTexture;
         turretCap.GetComponent <SpriteRenderer>().sortingOrder = turretCapLayer;
     }
     myShadow.RestartShadow();
 }