mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
Merge branch 'master' of https://github.com/ETSConjure/PixelSphinx
Conflicts: Assets/Scripts/PlanetManager.cs
This commit is contained in:
commit
ad03730dbb
@ -43,25 +43,37 @@ public class AsteroidSpawner : TimerFunctionsClass
|
||||
|
||||
public void SpawnAsteroidEvent()
|
||||
{
|
||||
|
||||
|
||||
var planet = FindObjectOfType<PlanetManager>();
|
||||
|
||||
if (!GenerationVersLesjoueurs)
|
||||
{
|
||||
// Random entre 10 et 20, * 1 ou -1
|
||||
var x = UnityEngine.Random.Range(30.0f, 40.0f)*(Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f))*2 - 1);
|
||||
var y = UnityEngine.Random.Range(20.0f, 30.0f)*(Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f))*2 - 1);
|
||||
//var x = UnityEngine.Random.Range(30.0f, 40.0f)*(Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f))*2 - 1);
|
||||
//var y = UnityEngine.Random.Range(20.0f, 30.0f)*(Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f))*2 - 1);
|
||||
|
||||
|
||||
var angleRandom = UnityEngine.Random.Range(0, 359.9f);
|
||||
|
||||
|
||||
//0-3
|
||||
var AsteroidType = Mathf.RoundToInt(Mathf.Floor(UnityEngine.Random.Range(0f, 3.999f)));
|
||||
|
||||
//instantiate as child of AsteroidSpawner
|
||||
var a = Instantiate(AsteroidPrefabTypes[AsteroidType], new Vector3(x, y, 0.0f), Quaternion.identity);
|
||||
//var a = Instantiate(AsteroidPrefabTypes[AsteroidType], new Vector3(x, y, 0.0f), Quaternion.identity);
|
||||
|
||||
Instantiate(AsteroidPrefabTypes[AsteroidType],
|
||||
planet.GetPlanetCoordinatesFromPlayerXY(angleRandom, UnityEngine.Random.Range(15f, 25f)),
|
||||
Quaternion.identity);
|
||||
|
||||
//a.tranform.parent = this.transform;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var players = GameObject.FindGameObjectsWithTag("Player");
|
||||
var planet = FindObjectOfType<PlanetManager>();
|
||||
|
||||
foreach (var p in players)
|
||||
{
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ public class Earthquake : MonoBehaviour {
|
||||
// Update is called once per frame
|
||||
public void Update () {
|
||||
|
||||
if(!isExploding) return;
|
||||
if(isExploding) return;
|
||||
|
||||
float disbalance = pmgr.GetDisbalance();
|
||||
float val = Mathf.Clamp((disbalance-CriticalMin) / (CriticalMax-CriticalMin),0,1);
|
||||
@ -38,7 +38,7 @@ public class Earthquake : MonoBehaviour {
|
||||
|
||||
core.color = new Color(1f, 1f - val, 1f - val);
|
||||
|
||||
if (val2 >= 1f)
|
||||
if (val2 >= CriticalMax + 0.05f)
|
||||
{
|
||||
EarthquakeBoom();
|
||||
}
|
||||
@ -58,6 +58,12 @@ public class Earthquake : MonoBehaviour {
|
||||
isExploding = true;
|
||||
StartCoroutine(Explode());
|
||||
Instantiate(ExplosionParticle);
|
||||
var camera = GameObject.Find("Main Camera");
|
||||
if (camera)
|
||||
{
|
||||
var shaker = camera.GetComponent<CameraShake>();
|
||||
if (shaker) shaker.shakeTimeAmount = 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Explode()
|
||||
|
||||
@ -7,6 +7,7 @@ public class PlanetManager : MonoBehaviour
|
||||
{
|
||||
public float PlayerAngle;
|
||||
public float PlayerOffset;
|
||||
public int _NbActivePlayersRemaining = 0;
|
||||
public int NbCartiers = 10;
|
||||
public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360
|
||||
public float CartierResetRatioSpeedFactor = 0.23f; //Entre 0.05 et 1 ou plus on aime que ca restore lentement, randomnly
|
||||
@ -116,6 +117,30 @@ public class PlanetManager : MonoBehaviour
|
||||
w.sprite.transform.localScale = new Vector3(w.offset, w.offset,1.0f);
|
||||
}
|
||||
//TODO_SR For each player
|
||||
VerifierPlayersActif();
|
||||
|
||||
if (_NbActivePlayersRemaining <= 1)
|
||||
{
|
||||
//TODO Call WorldManger.EndGame ou whatever
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void VerifierPlayersActif()
|
||||
{
|
||||
|
||||
int nbJoueursTrouves = 0;
|
||||
var players = GameObject.FindGameObjectsWithTag("Player");
|
||||
|
||||
foreach (var p in players)
|
||||
{
|
||||
if (p.GetComponent<Astronaut>().State < Astronaut.AstronautState.Ejecting)
|
||||
{
|
||||
nbJoueursTrouves++;
|
||||
}
|
||||
}
|
||||
|
||||
_NbActivePlayersRemaining = nbJoueursTrouves;
|
||||
}
|
||||
|
||||
public void PushWedge(float thetaPlayerX)
|
||||
|
||||
25
Assets/Scripts/WorldManager.cs
Normal file
25
Assets/Scripts/WorldManager.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class WorldManager : MonoBehaviour {
|
||||
|
||||
private static WorldManager instance = null;
|
||||
private WorldManager(){}
|
||||
|
||||
// Use this for initialization
|
||||
public void Awake () {
|
||||
if (!instance)
|
||||
{
|
||||
instance = new WorldManager();
|
||||
}
|
||||
}
|
||||
|
||||
public WorldManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/WorldManager.cs.meta
Normal file
12
Assets/Scripts/WorldManager.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3eaea4cf17643ba42939e209672bc39e
|
||||
timeCreated: 1460233556
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1103,6 +1103,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 015d8005b8f2f454da584e55b55711f5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
shakeTimeAmount: 2
|
||||
shakeTimeAmount: 0
|
||||
shakeAmount: 0.6
|
||||
decreaseFactor: 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user