Flamethrower on right click, flying enemies

Proper collisions, can kill with flamethrower as well
This commit is contained in:
Norbi Peti 2020-12-08 00:13:57 +01:00
parent a1d9bab668
commit 18ac1cba8c
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
5 changed files with 4751 additions and 12 deletions

View file

@ -9,7 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1529445790525209946}
m_Layer: 0
m_Layer: 9
m_Name: Foot
m_TagString: Untagged
m_Icon: {fileID: 4422084297763085224, guid: 0000000000000000d000000000000000, type: 0}
@ -43,7 +43,7 @@ GameObject:
- component: {fileID: 7250562544566202696}
- component: {fileID: 7250562544566202697}
- component: {fileID: -1018939148389277147}
m_Layer: 0
m_Layer: 9
m_Name: Enemy
m_TagString: Enemy
m_Icon: {fileID: 0}

File diff suppressed because it is too large Load diff

View file

@ -48,6 +48,8 @@ public class EnemyController : CharacterControllerBase
if (diff.y > 5 || diff.x > 20)
Remove();
if (diff.y > 1)
_rb.AddForce(new Vector2(0, 10f));
diff.Normalize();
float sp = ((float) _random.NextDouble() / 2f + 1f) * speed; //1 és 1.5 közötti szorzó
_rb.AddForce(diff * sp);
@ -99,4 +101,10 @@ public class EnemyController : CharacterControllerBase
_rb.velocity = Vector2.zero;
gameObject.SetActive(false);
}
private void OnParticleCollision(GameObject other)
{
if (IsAlive() && _random.Next(5) == 0)
Die();
}
}

View file

@ -8,11 +8,13 @@ public class WeaponFireController : MonoBehaviour
public GameObject prefab;
public Transform firePoint;
private ObjectPool _pool;
private ParticleSystem _particle;
// Start is called before the first frame update
void Start()
{
_pool = new ObjectPool(prefab, 10);
_particle = firePoint.GetComponent<ParticleSystem>();
}
// Update is called once per frame
@ -37,5 +39,10 @@ public class WeaponFireController : MonoBehaviour
rocketTransform.rotation = targetRotation;
theRocket.SetActive(true);
}
if (Input.GetButtonDown("Fire2"))
_particle.Play();
else if (Input.GetButtonUp("Fire2"))
_particle.Stop();
}
}

View file

@ -17,7 +17,7 @@ TagManager:
-
-
- Ground
-
- Enemy
-
-
-