Added ennemy
Added new textures Fixed collision issues (Not having a RigidBody ...)
This commit is contained in:
parent
686335b355
commit
a571cf1d4b
14 changed files with 592 additions and 8 deletions
|
@ -1,18 +1,30 @@
|
|||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyCharacter : MonoBehaviour
|
||||
public class EnemyCharacter : AbstractCharacter
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
public override void Move(Vector2 movementDirection)
|
||||
{
|
||||
|
||||
_mover.Direction = movementDirection;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
public override void Shoot()
|
||||
{
|
||||
|
||||
// Always shoot
|
||||
_shooter.Shoot(_shooter.EnergyCost+1);
|
||||
}
|
||||
|
||||
// TODO : Gain points, maybe through Events?
|
||||
protected override void Death()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
// Don't gain points
|
||||
private void OnBecameInvisible()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
|
20
Assets/Scripts/RightLeftAI.cs
Normal file
20
Assets/Scripts/RightLeftAI.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RightLeftAI : MonoBehaviour
|
||||
{
|
||||
private AbstractCharacter _character;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_character = GetComponentInParent<AbstractCharacter>();
|
||||
_character.Move(Vector2.left);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
_character.Shoot();
|
||||
}
|
||||
}
|
11
Assets/Scripts/RightLeftAI.cs.meta
Normal file
11
Assets/Scripts/RightLeftAI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 46c6580a49fa016aea4bf32400397f7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 100
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue