Fixed a lot of errors:
Obosolet methods, null references Removed dead code Clean Code
This commit is contained in:
parent
15a847cbde
commit
5a58064e4d
@ -8,7 +8,8 @@ public class laserScript : MonoBehaviour {
|
|||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
laserLine = GetComponentInChildren<LineRenderer> ();
|
laserLine = GetComponentInChildren<LineRenderer> ();
|
||||||
laserLine.SetWidth (.2f, .2f);
|
laserLine.startWidth = .2f;
|
||||||
|
laserLine.endWidth = .2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -240,7 +240,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 5827ef60d322c73468e816b5411af65a, type: 3}
|
m_Script: {fileID: 11500000, guid: 5827ef60d322c73468e816b5411af65a, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
restartButton: {fileID: 0}
|
restartButton: {fileID: 344149856}
|
||||||
--- !u!1 &117032977
|
--- !u!1 &117032977
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -873,9 +873,6 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
distanceText: {fileID: 2089165862}
|
distanceText: {fileID: 2089165862}
|
||||||
numberCoinsText: {fileID: 142150283}
|
numberCoinsText: {fileID: 142150283}
|
||||||
joueur1Text: {fileID: 0}
|
|
||||||
joueur2Text: {fileID: 0}
|
|
||||||
is1v1Mode: 0
|
|
||||||
--- !u!1 &963194225
|
--- !u!1 &963194225
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1052,7 +1049,10 @@ PrefabInstance:
|
|||||||
propertyPath: PlayerHUD
|
propertyPath: PlayerHUD
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents:
|
||||||
|
- {fileID: 7509186232753540492, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
|
||||||
|
- {fileID: 7896966939631641298, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
|
||||||
|
- {fileID: 6456075115708800826, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
|
@ -711,9 +711,6 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
distanceText: {fileID: 393375357}
|
distanceText: {fileID: 393375357}
|
||||||
numberCoinsText: {fileID: 403573105}
|
numberCoinsText: {fileID: 403573105}
|
||||||
joueur1Text: {fileID: 0}
|
|
||||||
joueur2Text: {fileID: 0}
|
|
||||||
is1v1Mode: 1
|
|
||||||
--- !u!1 &565350509
|
--- !u!1 &565350509
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1697,7 +1694,10 @@ PrefabInstance:
|
|||||||
propertyPath: PlayerHUD
|
propertyPath: PlayerHUD
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents:
|
||||||
|
- {fileID: 7509186232753540492, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
|
||||||
|
- {fileID: 7896966939631641298, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
|
||||||
|
- {fileID: 6456075115708800826, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
@ -2103,7 +2103,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: -267, y: -23.000015}
|
m_AnchoredPosition: {x: -267, y: -23.000015}
|
||||||
m_SizeDelta: {x: 215.7859, y: 191.7685}
|
m_SizeDelta: {x: 215.7859, y: 189.79}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &2043114202
|
--- !u!114 &2043114202
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
using System.Collections;
|
using Pools;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[RequireComponent(typeof(BoxCollider))]
|
namespace Obstacles
|
||||||
public class Obstacle : PoolingObject<Obstacle>, IObstacle,IDamageDealer,IResettable
|
|
||||||
{
|
{
|
||||||
|
[RequireComponent(typeof(BoxCollider))]
|
||||||
|
public class Obstacle : PoolingObject<Obstacle>, IObstacle,IDamageDealer,IResettable
|
||||||
|
{
|
||||||
[field: SerializeField] public bool IsOnAllLanes { get; private set; }
|
[field: SerializeField] public bool IsOnAllLanes { get; private set; }
|
||||||
[field: SerializeField] public bool IsInevitable { get; private set; }
|
[field: SerializeField] public bool IsInevitable { get; private set; }
|
||||||
public BoxCollider Collider { get; private set; }
|
public BoxCollider Collider { get; private set; }
|
||||||
@ -12,6 +13,7 @@ public class Obstacle : PoolingObject<Obstacle>, IObstacle,IDamageDealer,IResett
|
|||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Collider = GetComponent<BoxCollider>();
|
Collider = GetComponent<BoxCollider>();
|
||||||
|
OwningPool = FindFirstObjectByType<ObstaclePool>();
|
||||||
}
|
}
|
||||||
public void ResetToDefault()
|
public void ResetToDefault()
|
||||||
{
|
{
|
||||||
@ -30,4 +32,5 @@ public class Obstacle : PoolingObject<Obstacle>, IObstacle,IDamageDealer,IResett
|
|||||||
{
|
{
|
||||||
target.TakeDamage(amount);
|
target.TakeDamage(amount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ public class Player : MonoBehaviour, IResettable, ICommandTranslator
|
|||||||
public bool IsInvincible { get; private set; }
|
public bool IsInvincible { get; private set; }
|
||||||
public float InvincibilityTime { get; private set; } //PLAYER DATA ScriptableObject
|
public float InvincibilityTime { get; private set; } //PLAYER DATA ScriptableObject
|
||||||
[SerializeField] private Boolean isPlayer2;
|
[SerializeField] private Boolean isPlayer2;
|
||||||
[SerializeField] private Boolean isPlaying1VS1;
|
|
||||||
public bool isDead = false;
|
public bool isDead = false;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
@ -132,20 +131,6 @@ public class Player : MonoBehaviour, IResettable, ICommandTranslator
|
|||||||
PlayerStateMachine.SetState(PlayerStateMachine.PlayerDeadState);
|
PlayerStateMachine.SetState(PlayerStateMachine.PlayerDeadState);
|
||||||
GameSession.Instance.UpdateScoreboard(new ScoreboardEntry(name, PlayerStatictics.Score));
|
GameSession.Instance.UpdateScoreboard(new ScoreboardEntry(name, PlayerStatictics.Score));
|
||||||
GameSession.Instance.HandlePlayerDeath(this); // Informe GameSession qu'un joueur est mort
|
GameSession.Instance.HandlePlayerDeath(this); // Informe GameSession qu'un joueur est mort
|
||||||
|
|
||||||
// PlayerStateMachine.SetState(PlayerStateMachine.PlayerDeadState);
|
|
||||||
// GameSession.Instance.UpdateScoreboard(new ScoreboardEntry(name, PlayerStatictics.Score));
|
|
||||||
// if (isPlaying1VS1)
|
|
||||||
// {
|
|
||||||
// // SceneManager.LoadScene("DeathScreen1v1");
|
|
||||||
// SceneManager.LoadScene("Death1VS1");
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// SceneManager.LoadScene("Death1VS1");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator GrantInvincibility()
|
public IEnumerator GrantInvincibility()
|
||||||
|
@ -1,39 +1,38 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class PlayerAnimator
|
public class PlayerAnimator
|
||||||
{
|
{
|
||||||
private Animator animator;
|
private readonly Animator _animator;
|
||||||
private int runningHash = Animator.StringToHash("Run");
|
private readonly int _runningHash = Animator.StringToHash("Run");
|
||||||
private int deadHash = Animator.StringToHash("Dead");
|
private readonly int _deadHash = Animator.StringToHash("Dead");
|
||||||
private int jumpHash = Animator.StringToHash("Jump");
|
private readonly int _jumpHash = Animator.StringToHash("Jump");
|
||||||
private int slideHash = Animator.StringToHash("Slide");
|
private readonly int _slideHash = Animator.StringToHash("Slide");
|
||||||
private int idleHash = Animator.StringToHash("Idle");
|
private readonly int _idleHash = Animator.StringToHash("Idle");
|
||||||
|
|
||||||
public PlayerAnimator(Animator animator)
|
public PlayerAnimator(Animator animator)
|
||||||
{
|
{
|
||||||
if (animator)
|
if (animator)
|
||||||
this.animator = animator;
|
this._animator = animator;
|
||||||
}
|
}
|
||||||
public void SetRunState(bool isRunning)
|
public void SetRunState(bool isRunning)
|
||||||
{
|
{
|
||||||
animator?.SetBool(runningHash, isRunning);
|
_animator?.SetBool(_runningHash, isRunning);
|
||||||
}
|
}
|
||||||
public void SetJumpState(bool isJumping)
|
public void SetJumpState(bool isJumping)
|
||||||
{
|
{
|
||||||
animator?.SetBool(jumpHash, isJumping);
|
_animator?.SetBool(_jumpHash, isJumping);
|
||||||
}
|
}
|
||||||
public void SetDeadState(bool isDead)
|
public void SetDeadState(bool isDead)
|
||||||
{
|
{
|
||||||
animator?.SetBool(deadHash, isDead);
|
_animator?.SetBool(_deadHash, isDead);
|
||||||
}
|
}
|
||||||
public void SetSlideState(bool isSliding)
|
public void SetSlideState(bool isSliding)
|
||||||
{
|
{
|
||||||
animator?.SetBool(slideHash, isSliding);
|
_animator?.SetBool(_slideHash, isSliding);
|
||||||
}
|
}
|
||||||
public void SetIdleState(bool isIdle)
|
public void SetIdleState(bool isIdle)
|
||||||
{
|
{
|
||||||
animator?.SetBool(idleHash, isIdle);
|
if(_animator){}
|
||||||
|
_animator?.SetBool(_idleHash, isIdle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ public abstract class MovingState : PlayerState
|
|||||||
public override void Tick()
|
public override void Tick()
|
||||||
{
|
{
|
||||||
speed = playerData.CurrentSpeed;
|
speed = playerData.CurrentSpeed;
|
||||||
//HandleDirection();
|
|
||||||
playerSM.HorizontalDeltaPosition = playerSM.PlayerTransform.forward * speed * Time.deltaTime ;
|
playerSM.HorizontalDeltaPosition = playerSM.PlayerTransform.forward * speed * Time.deltaTime ;
|
||||||
playerSM.HorizontalDeltaPosition += playerSM.PlayerTransform.forward * speed * Time.deltaTime;
|
playerSM.HorizontalDeltaPosition += playerSM.PlayerTransform.forward * speed * Time.deltaTime;
|
||||||
playerSM.UpdateDistance(playerSM.HorizontalDeltaPosition.z); //вынести в контроллер
|
playerSM.UpdateDistance(playerSM.HorizontalDeltaPosition.z); //вынести в контроллер
|
||||||
@ -38,28 +37,6 @@ public abstract class MovingState : PlayerState
|
|||||||
playerSM.VerticalDeltaPosition += gravity * Time.deltaTime;
|
playerSM.VerticalDeltaPosition += gravity * Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//private void HandleDirection()
|
|
||||||
//{
|
|
||||||
// switch (playerSM.InputDirection)
|
|
||||||
// {
|
|
||||||
// case EInputDirection.RIGHT:
|
|
||||||
// playerSM.IncreaseTargetLane();
|
|
||||||
// break;
|
|
||||||
// case EInputDirection.LEFT:
|
|
||||||
// playerSM.DecreaseTargetLane();
|
|
||||||
// break;
|
|
||||||
// case EInputDirection.UP:
|
|
||||||
// playerSM.SetState(playerSM.PlayerJumpState);
|
|
||||||
// break;
|
|
||||||
// case EInputDirection.DOWN:
|
|
||||||
// playerSM.SetState(playerSM.PlayerSlideState);
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void SwitchLane()
|
public void SwitchLane()
|
||||||
{
|
{
|
||||||
float sidewaysPos = playerTransform.localPosition.x;
|
float sidewaysPos = playerTransform.localPosition.x;
|
||||||
@ -83,9 +60,6 @@ public abstract class MovingState : PlayerState
|
|||||||
playerSM.HorizontalDeltaPosition += playerSM.PlayerTransform.right * diffX.x;
|
playerSM.HorizontalDeltaPosition += playerSM.PlayerTransform.right * diffX.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
public class Statistics : MonoBehaviour,IResettable
|
public class Statistics : MonoBehaviour,IResettable
|
||||||
{
|
{
|
||||||
@ -12,7 +13,7 @@ public class Statistics : MonoBehaviour,IResettable
|
|||||||
public event Action<int> OnCoinCountChanged = delegate { };
|
public event Action<int> OnCoinCountChanged = delegate { };
|
||||||
public event Action<float> OnDistanceChanged = delegate { };
|
public event Action<float> OnDistanceChanged = delegate { };
|
||||||
public event Action<int> OnScoreCalculated = delegate { };
|
public event Action<int> OnScoreCalculated = delegate { };
|
||||||
[SerializeField] private PlayerHUDView PlayerHUD;
|
[FormerlySerializedAs("PlayerHUD")] [SerializeField] private PlayerHUDView playerHUD;
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
ResetToDefault();
|
ResetToDefault();
|
||||||
@ -43,7 +44,7 @@ public class Statistics : MonoBehaviour,IResettable
|
|||||||
{
|
{
|
||||||
Score = Mathf.FloorToInt(coinCount * coinMultiplier + distance);
|
Score = Mathf.FloorToInt(coinCount * coinMultiplier + distance);
|
||||||
OnScoreCalculated?.Invoke(Score);
|
OnScoreCalculated?.Invoke(Score);
|
||||||
PlayerHUD.UpdateScore(Score.ToString());
|
playerHUD.UpdateScore(Score.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetToDefault()
|
public void ResetToDefault()
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using Obstacles;
|
||||||
|
|
||||||
namespace Pools
|
namespace Pools
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Obstacles;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[RequireComponent(typeof(BoxCollider))]
|
[RequireComponent(typeof(BoxCollider))]
|
||||||
|
@ -1,27 +1,26 @@
|
|||||||
|
using System.IO;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.IO;
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
public class CubemapTextureBuilder : EditorWindow
|
namespace Utils
|
||||||
{
|
{
|
||||||
|
public class CubemapTextureBuilder : EditorWindow
|
||||||
|
{
|
||||||
[MenuItem("Tools/Cubemap Builder")]
|
[MenuItem("Tools/Cubemap Builder")]
|
||||||
public static void OpenWindow()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
GetWindow<CubemapTextureBuilder>();
|
GetWindow<CubemapTextureBuilder>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D[] textures = new Texture2D[6];
|
private readonly Texture2D[] _textures = new Texture2D[6];
|
||||||
string[] labels = new string[] {
|
private readonly string[] _labels = new string[] {
|
||||||
"Right", "Left",
|
"Right", "Left",
|
||||||
"Top", "Bottom",
|
"Top", "Bottom",
|
||||||
"Front", "Back"
|
"Front", "Back"
|
||||||
};
|
};
|
||||||
|
|
||||||
TextureFormat[] HDRFormats = new TextureFormat[] {
|
private readonly TextureFormat[] _hdrFormats = new TextureFormat[] {
|
||||||
TextureFormat.ASTC_HDR_10x10 ,
|
TextureFormat.ASTC_HDR_10x10 ,
|
||||||
TextureFormat.ASTC_HDR_12x12 ,
|
TextureFormat.ASTC_HDR_12x12 ,
|
||||||
TextureFormat.ASTC_HDR_4x4 ,
|
TextureFormat.ASTC_HDR_4x4 ,
|
||||||
@ -33,7 +32,7 @@ public class CubemapTextureBuilder : EditorWindow
|
|||||||
TextureFormat.RGBAHalf
|
TextureFormat.RGBAHalf
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector2Int[] placementRects = new Vector2Int[]
|
private readonly Vector2Int[] _placementRects = new Vector2Int[]
|
||||||
{
|
{
|
||||||
new Vector2Int(2, 1),
|
new Vector2Int(2, 1),
|
||||||
new Vector2Int(0, 1),
|
new Vector2Int(0, 1),
|
||||||
@ -48,30 +47,30 @@ public class CubemapTextureBuilder : EditorWindow
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
textures[i] = EditorGUILayout.ObjectField(labels[i], textures[i], typeof(Texture2D), false) as Texture2D;
|
_textures[i] = EditorGUILayout.ObjectField(_labels[i], _textures[i], typeof(Texture2D), false) as Texture2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("Build Cubemap"))
|
if (GUILayout.Button("Build Cubemap"))
|
||||||
{
|
{
|
||||||
// Missing Texture
|
// Missing Texture
|
||||||
if (textures.Any(t => t == null))
|
if (_textures.Any(t => t == null))
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayDialog("Cubemap Builder Error", "One or more texture is missing.", "Ok");
|
EditorUtility.DisplayDialog("Cubemap Builder Error", "One or more texture is missing.", "Ok");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get size
|
// Get size
|
||||||
var size = textures[0].width;
|
var size = _textures[0].width;
|
||||||
|
|
||||||
// Not all of the same size or square
|
// Not all of the same size or square
|
||||||
if (textures.Any(t => (t.width != size) || (t.height != size)))
|
if (_textures.Any(t => (t.width != size) || (t.height != size)))
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayDialog("Cubemap Builder Error", "All the textures need to be the same size and square.", "Ok");
|
EditorUtility.DisplayDialog("Cubemap Builder Error", "All the textures need to be the same size and square.", "Ok");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isHDR = HDRFormats.Any(f => f == textures[0].format);
|
var isHDR = _hdrFormats.Any(f => f == _textures[0].format);
|
||||||
var texturePaths = textures.Select(t => AssetDatabase.GetAssetPath(t)).ToArray();
|
var texturePaths = _textures.Select(AssetDatabase.GetAssetPath).ToArray();
|
||||||
|
|
||||||
// Should be ok, ask for the file path.
|
// Should be ok, ask for the file path.
|
||||||
var path = EditorUtility.SaveFilePanel("Save Cubemap", Path.GetDirectoryName(texturePaths[0]), "Cubemap", isHDR ? "exr" : "png");
|
var path = EditorUtility.SaveFilePanel("Save Cubemap", Path.GetDirectoryName(texturePaths[0]), "Cubemap", isHDR ? "exr" : "png");
|
||||||
@ -79,10 +78,10 @@ public class CubemapTextureBuilder : EditorWindow
|
|||||||
if (string.IsNullOrEmpty(path)) return;
|
if (string.IsNullOrEmpty(path)) return;
|
||||||
|
|
||||||
// Save the readable flag to restore it afterwards
|
// Save the readable flag to restore it afterwards
|
||||||
var readableFlags = textures.Select(t => t.isReadable).ToArray();
|
var readableFlags = _textures.Select(t => t.isReadable).ToArray();
|
||||||
|
|
||||||
// Get the importer and mark the textures as readable
|
// Get the importer and mark the textures as readable
|
||||||
var importers = texturePaths.Select(p => TextureImporter.GetAtPath(p) as TextureImporter).ToArray();
|
var importers = texturePaths.Select(p => AssetImporter.GetAtPath(p) as TextureImporter).ToArray();
|
||||||
|
|
||||||
foreach (var importer in importers)
|
foreach (var importer in importers)
|
||||||
{
|
{
|
||||||
@ -101,7 +100,7 @@ public class CubemapTextureBuilder : EditorWindow
|
|||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
cubeTexture.SetPixels(placementRects[i].x * size, placementRects[i].y * size, size, size, textures[i].GetPixels(0));
|
cubeTexture.SetPixels(_placementRects[i].x * size, _placementRects[i].y * size, size, size, _textures[i].GetPixels(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
cubeTexture.Apply(false);
|
cubeTexture.Apply(false);
|
||||||
@ -124,9 +123,12 @@ public class CubemapTextureBuilder : EditorWindow
|
|||||||
AssetDatabase.ImportAsset(path);
|
AssetDatabase.ImportAsset(path);
|
||||||
|
|
||||||
var cubeImporter = AssetImporter.GetAtPath(path) as TextureImporter;
|
var cubeImporter = AssetImporter.GetAtPath(path) as TextureImporter;
|
||||||
|
if (cubeImporter)
|
||||||
|
{
|
||||||
cubeImporter.textureShape = TextureImporterShape.TextureCube;
|
cubeImporter.textureShape = TextureImporterShape.TextureCube;
|
||||||
cubeImporter.sRGBTexture = false;
|
cubeImporter.sRGBTexture = false;
|
||||||
cubeImporter.generateCubemap = TextureImporterGenerateCubemap.FullCubemap;
|
cubeImporter.generateCubemap = TextureImporterGenerateCubemap.FullCubemap;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var p in texturePaths)
|
foreach (var p in texturePaths)
|
||||||
{
|
{
|
||||||
@ -137,4 +139,5 @@ public class CubemapTextureBuilder : EditorWindow
|
|||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using Assets.Scripts.GameSession;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -20,6 +21,6 @@ public class RestartButton : MonoBehaviour
|
|||||||
|
|
||||||
public void RestartGame()
|
public void RestartGame()
|
||||||
{
|
{
|
||||||
SceneManager.LoadScene("GameScene");
|
GoToScene.GoToSoloMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user