Spawn() public method

public Spawn ( ) : void
return void
Beispiel #1
0
    IEnumerator HitEnemyCoroutine()
    {
        anim.Play("VGHit");
        freeze = true;

        yield return(new WaitForSeconds(animationTimes.GetTime("VGHit")));

        // Destroy and respawn Player
        SpawnPlayer spawnPlayer = FindObjectOfType <SpawnPlayer>();

        spawnPlayer.Spawn();
        Destroy(gameObject);
    }
Beispiel #2
0
    public void StartGame(string sceneName)
    {
        if (GameManager.Instance.players.Count < 2)
        {
            for (int i = 0; i < playersToSpawn; ++i)
            {
                spawner.Spawn(i);
                Debug.Log("[Menu] Spawned player " + i);
            }
        }

        GameManager.Instance.ResetLives();
        GameManager.Instance.LoadLevel(sceneName);
        startGame.SetActive(false);//Edit: quick fix for double clicking start game and loadig 2 istances of the level
    }
    void Awake()
    {
        m_BossPanel.alpha = 0;

        m_MainUI.enabled = true;

        m_Lose.enabled = false;
        m_Win.enabled  = false;

        m_Restart  = false;
        m_GameOver = false;
        m_Play     = false;

        m_PSpawn.Spawn();
        m_Player = m_PSpawn.m_Player;
        m_GData  = GameObject.Find("GameData").GetComponent <GameData>();
        m_PData  = GameObject.Find("PlayerData").GetComponent <PlayerData>();
    }
Beispiel #4
0
    IEnumerator HitEnemyCoroutine(Enemy enemy)
    {
        yield return(new WaitForEndOfFrame());

        if (enemy.dangerous)
        {
            velocity.x = enemy.pushBackForce * Mathf.Sign(transform.position.x - enemy.transform.position.x);
            anim.Play("FrogHit");
            _freeze = true;

            // Wait for the time of the FrogHit animation to be finished
            yield return(new WaitForSeconds(animationTimes.GetTime("FrogHit")));

            SpawnPlayer spawnPlayer = FindObjectOfType <SpawnPlayer>();
            spawnPlayer.Spawn();

            _freeze = false;
            Destroy(gameObject);
        }
        hitEnemy = null;
    }
Beispiel #5
0
    private void Start()
    {
        Messenger.AddListener <GameObject>(GameEvents.ENTITY_DEAD, OnEntityDead);
        Messenger.AddListener <BossStats>(GameEvents.BOSS_WERE_KILLED, OnBossDead);
        Messenger.AddListener(GameEvents.PLAYER_DEAD, OnPlayerDead);
        Messenger.AddListener <GameDataList, Action <object> >(GameEvents.REQUEST_GAME_DATA, AnswerToRequest);
        Messenger.AddListener <GameObject>(GameEvents.SHIP_SELECTED, OnSwitchShip);
        moneySession = 0;
        score        = 0;
        string path = prefabShipsPath + GameConstants.defaultPrefabShip;

        defaultPrefabShip = Resources.Load <GameObject>(path);
        LoadGame();
        RefreshLabelInfo();

        if (hangar != null)
        {
            hangar.SelectShip(currentPlayerShipPrefab);
        }
        if (spawnPlayer != null)
        {
            spawnPlayer.Spawn();
        }
    }