Пример #1
0
    private void Start()
    {
        var projectilePool = new GameObjectPool(_projectile, 30);
        var spawnCommand   = new SpawnEntityCommand(projectilePool, Owner.Player);

        SpawnerController.Init(spawnCommand);
    }
Пример #2
0
 void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #3
0
    void Start()
    {
        if (SceneManager.GetActiveScene().buildIndex > 0)
        {
            try
            {
                spawner = GameObject.Find("BirbSpawner").GetComponent <SpawnerController>();
            }
            catch
            {
                Debug.Log("Spawner not found, will try again in Update()");
            }

            if (spawner)
            {
                birb = spawner.getBirb();
            }
            if (birb)
            {
                birbStats = birb.GetComponent <StatsController>();
            }
            if (birbStats)
            {
                birbStats.setEggMax(eggCount);
            }

            SetEggCounter();
        }

        // Create a temporary reference to the current scene.
        Scene currentScene = SceneManager.GetActiveScene();
        // Retrieve the name of this scene.
        string sceneName = currentScene.name;
    }
Пример #4
0
 public static void AddSpawner(SpawnerController spawner)
 {
     if (!spawners.Contains(spawner))
     {
         spawners.Add(spawner);
     }
 }
Пример #5
0
    void reset()
    {
        GameObject[] blueSpawners = GameObject.FindGameObjectsWithTag("blueSpawner");
        GameObject[] redSpawners  = GameObject.FindGameObjectsWithTag("redSpawner");

        GameObject[] spawners = new GameObject[blueSpawners.Length + redSpawners.Length];

        blueSpawners.CopyTo(spawners, 0);
        redSpawners.CopyTo(spawners, blueSpawners.Length);

        foreach (GameObject spawner in spawners)
        {
            SpawnerController controller = spawner.GetComponent <SpawnerController>();

            if (controller.isActive)
            {
                controller.toggle();
            }
        }

        GameObject[] balls = GameObject.FindGameObjectsWithTag("bubble");

        foreach (GameObject ball in balls)
        {
            Destroy(ball);
        }
    }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     gmi = GameManager.Instance;
     pc  = FindObjectOfType <PointsController>();
     LoadGame("Player");
     spawnCtrl = FindObjectOfType <SpawnerController>();
 }
Пример #7
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #8
0
 void Start()
 {
     currentDelay   = maxDelay;
     update         = GameObject.FindGameObjectWithTag("Updater").GetComponent <Updater>();
     mainController = GameObject.FindGameObjectWithTag("SpawnerController").GetComponent <SpawnerController>();
     //  Spawn();
 }
Пример #9
0
 private void finalizeInitGame()
 {
     SpawnerController.StartSpawn();
     pointEarnedByAsteroid = 50;
     startGameTime         = Time.time;
     isGameStarted         = true;
 }
Пример #10
0
    // Use this for initialization
    void Start()
    {
        gameController = GameObject.Find("Main Camera").GetComponent <GameController>();

        Time.timeScale = gameController.appTime;

        hpBar = 100f;

        gameController.vivo = true;

        level = int.Parse(SecurePlayerPrefs.GetString("nowLevel", "10", "twistninja"));

        level = 30;

        if (gameController.getSound() > 0)
        {
            musicaAtual = Mathf.FloorToInt(Random.Range(0f, 1.9f));

            objetoMusica = Instantiate(musicasFundo [musicaAtual].GetComponent <AudioSource>(), transform.position, Quaternion.identity);
        }

        spwController = objSpawner.GetComponent <SpawnerController>();

        //preFabAtual = prefabBalaoJunto;

        preFabAtual = StaticLevelFactory.getPrefabLevel(level);
        spwController.DisInstance   = StaticLevelFactory.getDistanceLevel(level);
        spwController.isPlayerBased = StaticLevelFactory.getPlayerBasedLevel(level);
        spwController.movBallon     = StaticLevelFactory.getMovLevel(level);
        spwController.isMoving      = StaticLevelFactory.getIsMovingLevel(level);
        maxSpawnCount = StaticLevelFactory.getMaxSpawnLevel(level);

        showChapterLevel();
        playGame();
    }
Пример #11
0
    public void HandleNewTerrain(object sender, TerrainEventArgs e)
    {
        if (allSpawners == null)
        {
            return;
        }
        Vector3           tilePos        = e.tile.transform.position;
        SpawnerController closestSpawner = null;
        float             closest        = Mathf.Infinity;
        float             dist;

        foreach (SpawnerController spawner in allSpawners)
        {
            dist = Vector3.Distance(spawner.transform.position, tilePos);
            if (dist < closest)
            {
                closest        = dist;
                closestSpawner = spawner;
            }
        }
        if (closestSpawner != null)
        {
            foreach (Waypoint wp in closestSpawner.GetWaypoints())
            {
                wp.RecalculateNeighbors();
            }
        }
    }
Пример #12
0
    private void Start()
    {
        spawner = GameObject.Find("BirbSpawner").GetComponent <SpawnerController>();
        birb    = spawner.getBirb();
        anim    = birb.GetComponent <Animator>();

        resetAnim();
    }
Пример #13
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject go        = GameObject.FindGameObjectWithTag("Player");
        GameObject goSpawner = GameObject.FindGameObjectWithTag("Spawner");

        player  = go.GetComponent <PlayerController>();
        spawner = goSpawner.GetComponent <SpawnerController>();
    }
Пример #14
0
 // Use this for initialization
 void Start()
 {
     spriteRenderer = gameObject.GetComponentInParent <SpriteRenderer>();
     spawner        = gameObject.GetComponentInParent <SpawnerController>();
     audioSource    = gameObject.GetComponent <AudioSource>();
     CloseWindow();
     Invoke("OpenWindow", AutoOpenTime);
 }
Пример #15
0
    public void Initialise(Vector3 _pointA, Vector3 _pointB, Quaternion _rotation)
    {
        parentSpawner = transform.root.GetComponent<SpawnerController>();

        pointA = _pointA;
        pointB = _pointB;
        transform.rotation = _rotation;
    }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     spriteRenderer = gameObject.GetComponentInParent<SpriteRenderer>();
     spawner = gameObject.GetComponentInParent<SpawnerController>();
     audioSource = gameObject.GetComponent<AudioSource>();
     CloseWindow();
     Invoke("OpenWindow", AutoOpenTime);
 }
Пример #17
0
    private void Start()
    {
        // set throw vectors
        ThrowStartPos = transform.position;
        ThrowMidPos   = ThrowAmplitudeObject.position;
        //ThrowEndPos = ThrowEndObject.position;

        spawnerController = GameObject.Find("GameManager").GetComponent <SpawnerController>();
    }
Пример #18
0
 public void Init(SpawnerController currentSpawner, FernIgnore ignoredAxis, float ignoredSign)
 {
     this.ignoredSign   = 1;
     this.ignoredSign  *= Mathf.Sign(ignoredSign);
     this.ignoredAxis   = ignoredAxis;
     spawningController = currentSpawner;
     SpawnFern();
     StartCoroutine(DisableSpawnPoint());
 }
Пример #19
0
    internal void Start()
    {
        _phaseStart = Time.time;
        _nextWave   = new Wave(_waveNumber);
        _spawner    = GetComponent <SpawnerController>();
        FindObjectOfType <WaveInformationController>().Initialize();

        _nextNextWave = new Wave(_waveNumber + 1);
    }
Пример #20
0
    /// <summary>
    /// Разрушение лазером
    /// </summary>
    public void OnLaserDestroy()
    {
        AUDIO.PlaySoundOnce(0);
        GM.SetScore(1);
        SpawnerController spawner = this.GetComponentInParent <SpawnerController>();

        spawner.OnSpawnSmallRock(TR.position);
        Destroy(this.gameObject);
    }
Пример #21
0
 internal void Start()
 {
     _spawner = GetComponent <SpawnerController>();
     InitializeWaves();
     _nextWave     = _waves.Dequeue();
     _nextNextWave = _waves.Peek();
     FindObjectOfType <WaveInformationController>().Initialize();
     _phaseStart = Time.time;
 }
Пример #22
0
    public void Menu()
    {
        StartCoroutine(LoadMenuCor());
        GameObject SpawnControllerObject = GameObject.FindGameObjectWithTag("Spawnercontroller");

        spawncontroller = SpawnControllerObject.GetComponent <SpawnerController> ();
        GameObject PlayerControllerObject = GameObject.FindGameObjectWithTag("Player");

        playercontroller = PlayerControllerObject.GetComponent <PlayerController> ();
    }
Пример #23
0
 void Awake()
 {
     veryHardChance    = 20;
     hardChance        = 19;
     mediumChance      = 17;
     easychance        = 17;
     spawnerController = FindObjectOfType <SpawnerController> ();
     scoreManager      = FindObjectOfType <ScoreManager> ();
     pauseManager      = FindObjectOfType <PauseManager> ();
 }
Пример #24
0
 public void SpawnProjectile(Vector3 position)
 {
     if (SpawnerController.Capacity > 0)
     {
         SpawnerController.Spawn(new Vector3(position.x, Mathf.Max(_minY, position.y)));
     }
     else
     {
         SoundPlayer.Play("cant_shoot");
     }
 }
    //metod spawnar skot mot spelaren.
    private void SpawnShot()
    {
        lastSpawnTime    = Time.time;
        randomSpawnDelay = Random.Range(spawnDelay - deltaRandomSpawn, spawnDelay + deltaRandomSpawn);
        GameObject shots = Instantiate(shotsPrefab);

        shots.transform.position = transform.position;
        shooter.Add(shots);

        SpawnerController spawnerController = shots.GetComponentInChildren <SpawnerController>();
    }
    private GameObject SpawnFromContent(string content)
    {
        string[] contentArray = content.Split(' ');

        GameObject        returnedGameobject = Instantiate(SpawnerPrefab);
        SpawnerController spawnerController  = SpawnerPrefab.GetComponent <SpawnerController>();

        spawnerController.Init(contentArray[0], float.Parse(contentArray[1]), float.Parse(contentArray[2]), int.Parse(contentArray[3]), float.Parse(contentArray[4]), contentArray[5]);

        return(returnedGameobject);
    }
    public void Awake()
    {
        this.col             = this.GetComponent <Collider2D>();
        this.playerTransform = this.GetComponent <Transform>();
        this.sprtRend        = this.GetComponentInChildren <SpriteRenderer>();
        this.rb = this.GetComponent <Rigidbody2D>();

        this.joints    = GameObject.FindGameObjectWithTag("SpringJoints").GetComponent <SpringJointsController>();
        this.particles = GameObject.FindGameObjectWithTag("ParticleManager").GetComponent <ParticleManager>();
        this.spawner   = GameObject.FindGameObjectWithTag("SpawnerController").GetComponent <SpawnerController>();
        this.ui        = GameObject.FindGameObjectWithTag("Canvas").GetComponent <UIManager>();
        lifeBar        = GameObject.FindGameObjectWithTag("LifeBar").GetComponent <LifeBarManager>();
    }
Пример #28
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Enemy")
     {
         NPC npc = other.GetComponent <NPC>();
         npc.SofrerDano(Player.meusAtributos.Forssa);
     }
     if (other.tag == "Spawner")
     {
         SpawnerController SC = other.GetComponent <SpawnerController>();
         SC.SofrerDano(Player.meusAtributos.Forssa);
     }
 }
Пример #29
0
    void OnTriggerEnter(Collider other)
    {
        Transform transform = other.transform;

        if (transform.tag.Equals("BASE"))
        {
            SpawnerController controller = transform.GetComponent <SpawnerController> ();
            controller.hp -= 1;
        }
        else if (transform.tag.Equals("WEAPON") || transform.tag.Equals("MINION"))
        {
            Destroy(gameObject);
        }
    }
Пример #30
0
    void initRuck()
    {
        initSpawn = Spawners[Random.Range(0, Spawners.Count)];
        if (initSpawn != null)
        {
            initSpawn.SetObjects(TCamera, TRuck, TBall);
        }

        initPos = Positions[Random.Range(0, Positions.Count)];
        if (initPos != null)
        {
            initPos.gameObject.SetActive(true);
            initPos.SetObjects(initSpawn.direction, initSpawn.transform.position);
        }
    }
Пример #31
0
    // Use this for initialization
    void Start()
    {
        isRunning      = true;
        isColorMixable = true;
        OwnedMaterial  = GetComponent <Renderer>().material;

        spawnerController = GameObject.Find("GameManager").GetComponent <SpawnerController>();

        //getting the camera world bound extent
        double VerticalHightSeen    = Camera.main.orthographicSize * 2.0;
        double HorizontalHeightSeen = VerticalHightSeen * Screen.width / Screen.height;

        cameraWorldBounds    = Camera.main.transform.position;
        cameraWorldBounds.x += (float)HorizontalHeightSeen; //TODO: Check if this is the actual valid world bound
    }
Пример #32
0
 void Start()
 {
     _grid    = FindObjectOfType <GridController>();
     _spawner = FindObjectOfType <SpawnerController>();
     _base    = FindObjectOfType <BaseController>();
     _money   = FindObjectOfType <MoneyController>();
     if (Position.Equals(_spawner.Position) || Position.Equals(_base.Position))
     {
         _state = State.Objective;
     }
     else
     {
         _state = State.Empty;
     }
 }
Пример #33
0
    private List<GameObject> enemies = new List<GameObject>(); // TODO: more customisation
    #endregion

    #region Behaviour
    /// <summary>
    /// Game start logic
    /// </summary>
    void Start()
    {
        waveCurrent = 0;
        if (wavesConfig.Count == 0)
            wavesConfig = new List<uint>
            {
                1,2,3,4,5
            };
        waveCount = wavesConfig.Count;

        moneyCurrent = moneyStart;

        var castle = GameObject.Find(Constants.GameObjects.Castle);
        var castleController = castle.GetComponent<CastleController>();
        castleController.Death += GameOver; // Subscribe on castle death.

        var spawner = GameObject.Find(Constants.GameObjects.Spawner);
        spawnerController = spawner.GetComponent<SpawnerController>();
    }