//Called when we dead private void Dead() { //Set the entity state to dead entityState = EntityState.State.Dead; Destroy(GetComponent <PlayerDragController>()); BOVibrate.Vibrate(); BOVibrate.Vibrate(); //Disable the renderer and collider gameObject.GetComponent <Renderer>().enabled = false; gameObject.GetComponent <Collider2D>().enabled = false; //Destroy the particle tale on the object Destroy(gameObject.GetComponentInChildren <ParticleSystem>()); //Instantiate the dead particle system at this location Instantiate(deadParticleSystem, gameObject.transform); GameObject.FindGameObjectWithTag("ObjectController").GetComponent <ObjectSpawner>().CancelSpawner(); if (transform.GetComponentInParent <AudioSource>().enabled == true) { transform.GetComponentInParent <AudioSource>().Play(); } //Call restartlevel in 0.4 secs Invoke("EndLevel", 0.4f); AnalyticsEvent.GameOver(); }
void Ism.UpdateFrame(EntityState.State entityState) { List <int> nearPlayers = GameServer.world.GetPlayersAtRange(MapPosition, World.DEBUG_SIGHT_RANGE); List <int> nearMobs = GameServer.world.GetMobsAtRange(MapPosition, World.DEBUG_SIGHT_RANGE); UpdatePlayerWorld(nearPlayers, nearMobs); DispatchInfoToNearPlayers(nearPlayers, nearMobs); //entityState.BroadcastState(PosX, PosY); }
private void Hit() { GameController gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); //if we have more than 0 lives && if we are not invincible if (gameController.lives > 0 && entityState != EntityState.State.Invincible) { gameController.PlayerHit(); GetComponent <Collider2D>().enabled = false; StartCoroutine(GetComponent <PlayerMaterial>().Fade()); entityState = EntityState.State.Invincible; } //else if we are not invincible. else if (entityState != EntityState.State.Invincible) { Dead(); } }
private void Awake() { entityState = EntityState.State.Alive; gameObject.AddComponent <PlayerDragController>(); }
void Ism.UpdateFrame(EntityState.State entityState) { throw new NotImplementedException(); }