Skip to content
Extraits de code Groupes Projets
Valider 3ddfabfd rédigé par Pavel Krisys Verbel's avatar Pavel Krisys Verbel
Parcourir les fichiers

1st version

parent
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 272 ajouts et 0 suppression
fileFormatVersion: 2
guid: cff51c3bcb4b0a24caf8ccf9702ab6d4
folderAsset: yes
timeCreated: 1506353563
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Fichier ajouté
fileFormatVersion: 2
guid: 5f37cea552faaf843aceb62ce9f0a192
timeCreated: 1506412519
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Fichier ajouté
fileFormatVersion: 2
guid: aa77c85c0d4fedc4a9a7d0822826ec29
timeCreated: 1506414316
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Fichier ajouté
fileFormatVersion: 2
guid: b7d040d340613724d8fe77aa97d80cfe
timeCreated: 1506415337
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d164348f42c96bf45bdb3468197a0925
folderAsset: yes
timeCreated: 1506352437
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Fichier ajouté
fileFormatVersion: 2
guid: f6b0569d7d29d38489d9c9568155e95b
timeCreated: 1506352438
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 186778368acfd8f4984195eecfdba5df
folderAsset: yes
timeCreated: 1506348910
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BaseEnemyManager : MonoBehaviour
{
[SerializeField]
float minSpeed = 4;
[SerializeField]
float maxSpeed = 6;
[SerializeField]
float minTimeBetweenBullets = 0.4f;
[SerializeField]
float maxTimeBetweenBullets = 0.6f;
[SerializeField]
Vector3 moveDirection = new Vector3(-1, 0, 0);
[SerializeField]
Vector3 shootDirection = new Vector3(-1, 0, 0);
[SerializeField]
ShooterManager shooterManager;
[SerializeField]
MoveableManager moveableManager;
[SerializeField]
Renderer renderer;
// Use this for initialization
void Start ()
{
if (moveableManager)
{
moveableManager.speed = Random.Range(minSpeed, maxSpeed);
}
if (shooterManager)
{
shooterManager.timeBetweenBullets = Random.Range(minTimeBetweenBullets, maxTimeBetweenBullets);
}
}
// Update is called once per frame
void Update ()
{
moveableManager.Move(moveDirection);
shooterManager.Shoot(shootDirection);
if (Time.time > 0.05f && renderer && !renderer.isVisible)
{
Destroy(this.gameObject);
}
}
}
fileFormatVersion: 2
guid: 3b3dd5774c8681e46a6b8b99fbc095a7
timeCreated: 1506414425
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletManager : MonoBehaviour
{
[SerializeField]
private MoveableManager moveableManager;
[SerializeField]
private Renderer renderer;
[SerializeField]
private int damage = 1;
public Vector3 direction { private get; set; }
public bool player { private get; set; }
private void Update()
{
moveableManager.Move(direction);
if (!renderer.isVisible)
{
Destroy(this.gameObject);
}
}
private void OnTriggerEnter2D(Collider2D collision)
{
GameObject other = collision.gameObject;
if ((player && other.CompareTag("Enemy")) || (!player && other.CompareTag("Player")))
{
Destroy(this.gameObject);
HealthManager otherHealthManager = other.GetComponent<HealthManager>();
if(otherHealthManager)
{
otherHealthManager.TakeDamage(damage);
}
}
}
}
fileFormatVersion: 2
guid: ee23fd52ada496e4091452fb9bb4cc58
timeCreated: 1506353064
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyGenerator : MonoBehaviour {
[SerializeField]
GameObject[] enemyPrefabs;
[SerializeField]
float minY = -8;
[SerializeField]
float maxY = 8;
[SerializeField]
float X = 10;
[SerializeField]
float timeBetweenEnemies = 0.5f;
float lastEnemyTime = float.NegativeInfinity;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
if (enemyPrefabs.Length > 0 && Time.time - lastEnemyTime > timeBetweenEnemies)
{
int selectedEnemy = Random.Range((int)0, (int)enemyPrefabs.Length - 1);
float Y = Random.Range(minY, maxY);
GameObject newEnemy = Instantiate(enemyPrefabs[selectedEnemy]);
newEnemy.transform.position = new Vector3(X, Y, 0);
lastEnemyTime = Time.time;
}
}
}
fileFormatVersion: 2
guid: dc1ed7f060e0bfd45a4cd23db229efe4
timeCreated: 1506415394
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnergyManager : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: 18e1b5c2e58edb042a9f0384fcaa4ad6
timeCreated: 1506418374
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HealthManager : MonoBehaviour
{
[SerializeField] int maxHealth = 1;
int currentHealth;
private void Start()
{
currentHealth = maxHealth;
}
public void TakeDamage(int damage)
{
currentHealth -= damage;
if(currentHealth <= 0)
{
Destroy(this.gameObject);
}
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter