Refactorisation
This commit is contained in:
@@ -2,7 +2,7 @@ using UnityEngine;
|
||||
|
||||
public class Arrow : MonoBehaviour
|
||||
{
|
||||
public GameObject target;
|
||||
public GameObject Target;
|
||||
|
||||
private PlayerManager _manager;
|
||||
|
||||
@@ -13,12 +13,12 @@ public class Arrow : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (target == null)
|
||||
if (Target == null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(transform.position, target.transform.position, 20f * Time.deltaTime);
|
||||
transform.position = Vector3.MoveTowards(transform.position, Target.transform.position, 20f * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent (typeof(BoxCollider2D))]
|
||||
public class LaserBeam : MonoBehaviour
|
||||
public class Beam : MonoBehaviour
|
||||
{
|
||||
private PlayerManager _manager;
|
||||
private PlayerMovements _movements;
|
||||
@@ -20,9 +19,9 @@ public class LaserBeam : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_manager.laserOnX == 0)
|
||||
if (_manager.HorizontalBeam == 0)
|
||||
{
|
||||
if (!_movements.lookOnRight)
|
||||
if (!_movements.LookOnRight)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0f, 180f, 0f);
|
||||
} else
|
||||
@@ -94,9 +94,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 4430932250055150325}
|
||||
- component: {fileID: 3148908794889564978}
|
||||
- component: {fileID: 1475843655422961594}
|
||||
- component: {fileID: 7468774557436471496}
|
||||
m_Layer: 0
|
||||
m_Name: Laser Beam
|
||||
m_Name: Beam
|
||||
m_TagString: Beam
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -163,7 +163,7 @@ BoxCollider2D:
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 50, y: 0.16}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &1475843655422961594
|
||||
--- !u!114 &7468774557436471496
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -11,7 +11,7 @@ GameObject:
|
||||
- component: {fileID: 5476423095808072928}
|
||||
- component: {fileID: -8230784050683220836}
|
||||
m_Layer: 0
|
||||
m_Name: Halo
|
||||
m_Name: Sword Halo
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
@@ -1,13 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Halo : MonoBehaviour
|
||||
public class SwordHalo : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _sword;
|
||||
|
||||
private PlayerManager _manager;
|
||||
private List<GameObject> swords = new();
|
||||
private List<GameObject> _swords = new();
|
||||
|
||||
private float _oldRadius;
|
||||
private int _oldSwordsCount;
|
||||
@@ -27,7 +27,7 @@ public class Halo : MonoBehaviour
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
_swords.Add(sword);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ public class Halo : MonoBehaviour
|
||||
{
|
||||
for (int i = 0; i < _oldSwordsCount; i++)
|
||||
{
|
||||
Destroy(swords[i]);
|
||||
Destroy(_swords[i]);
|
||||
}
|
||||
swords.Clear();
|
||||
_swords.Clear();
|
||||
|
||||
float angle = Mathf.PI * 2f / _manager.SwordsQuantity;
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
@@ -70,7 +70,7 @@ public class Halo : MonoBehaviour
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
_swords.Add(sword);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ public class Halo : MonoBehaviour
|
||||
{
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
{
|
||||
DestroyImmediate(swords[i]);
|
||||
DestroyImmediate(_swords[i]);
|
||||
}
|
||||
swords.Clear();
|
||||
_swords.Clear();
|
||||
|
||||
float angle = Mathf.PI * 2f / _manager.SwordsQuantity;
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
@@ -91,7 +91,7 @@ public class Halo : MonoBehaviour
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
_swords.Add(sword);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user