public void Construct(PluginConfig config, AssetLoader assetLoader, PlatformSpawner platformSpawner, PlatformManager platformManager)
 {
     _config          = config;
     _assetLoader     = assetLoader;
     _platformManager = platformManager;
     _platformSpawner = platformSpawner;
 }
Example #2
0
 void Make_Instance() // can call function in this script
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    public void EndGame()
    {
        lb.UpdateLeaderBoard((int)s.Getscore());
        Platformer2DUserControl puc = transform.GetComponent <Platformer2DUserControl>();
        PlatformerCharacter2D   pc  = transform.GetComponent <PlatformerCharacter2D>();

        foreach (GameObject a in sp)
        {
            SpawnerScript ss = a.GetComponent <SpawnerScript>();
            ss.Stopinvokation();
            a.SetActive(false);
        }
        PlatformSpawner p = plat_s.GetComponent <PlatformSpawner>();

        p.Stopinvokation();
        plat_s.SetActive(false);
        SpawnerScript1 ss1 = sp1.GetComponent <SpawnerScript1>();

        ss1.Stopinvokation();
        sp1.SetActive(false);
        puc.enabled = false;
        pc.enabled  = false;
        s.Setincrement(0);
        if (robot_explosion)
        {
            var explosion = Instantiate(robot_explosion, transform.position, transform.rotation);
            Destroy(explosion, 1.0f);
        }
        anim.SetBool("Destroy", true);
        Scorecard.SetActive(true);
        Scorecard.GetComponent <Scorecard> ().SetScore((int)s.Getscore());
    }
Example #4
0
    private void InitializeComponentsInChildren()
    {
        environmentTransforms = GetComponentsInChildren <Transform> ();
        SpriteRenderer groundSprite = environmentTransforms [environmentTransforms.Length - 2].GetComponent <SpriteRenderer> ();

        npcSpawner = GetComponentInChildren <NPCSpawner> ();
        npcSpawner.Initialize(3, groundSprite);
        List <Transform> npcTransforms = npcSpawner.GetNPCTransforms();

        platformSpawner = GetComponentInChildren <PlatformSpawner> ();
        platformSpawner.Initialize(npcTransforms, groundSprite);


        playerData = SaveSystem.LoadPlayer();
        player.Initialize(this, playerData);
        player.transform.position = platformSpawner.GetPlayerSpawnPoint();
        meteorSpawner             = GetComponentInChildren <MeteorSpawner> ();
        meteorSpawner.Initialize();

        uiInGameHandler = GetComponentInChildren <UIInGameHandler> ();
        uiInGameHandler.Initialize(player, npcTransforms);

        NPCController [] npcControllers = FindObjectsOfType <NPCController> ();
        foreach (NPCController npc in npcControllers)
        {
            npc.Initialize(this, player.playerData.upgradeLevels[1]);
        }
    }
Example #5
0
 private void Start()
 {
     _diff = spawnPos.position - target.position;
     enemyPrefab.GetComponent <EnemyController>().target = target;
     _pool    = new ObjectPool(enemyPrefab.gameObject, 10);
     _spawner = GetComponent <PlatformSpawner>();
 }
 private void SetInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #7
0
 private void Start()
 {
     leftSpawnerScript  = leftSpawner.GetComponent <PlatformSpawner>();
     rightSpawnerScript = rightSpawner.GetComponent <PlatformSpawner>();
     lastPlatform       = SpawnedPlatform.Right;
     isFirstTime        = true;
 }
Example #8
0
 // Start is called before the first frame update
 void Start()
 {
     ps = GetComponent <PlatformSpawner>();
     platformCheckRadiusDict = new Dictionary <string, float>();
     sceneObjects            = GameObject.Find("SceneObjects");
     UpdateDict();
 }
Example #9
0
 void Start()
 {
     platformSpawner       = PlatformSpawner.GetComponent <PlatformSpawner>();
     platfromStartPosition = platformSpawner.spawnStartPoint;
     platfromEndPosition   = platformSpawner.lastEndPoint;
     StartCoroutine(CharacterSpawnTimer());
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #11
0
 void Awake()
 {
     if (_platformSpawnerInstance == null)
     {
         _platformSpawnerInstance = this;
     }
 }
Example #12
0
    // Start is called before the first frame update
    void Start()
    {
        _rb = GetComponent <Rigidbody2D>();
        var gm = GameObject.FindGameObjectWithTag("Game manager");

        _platformSpawner      = gm.GetComponent <PlatformSpawner>();
        _scoreAndAchievements = gm.GetComponent <ScoreAndAchievements>();
    }
 public PlatformsGameInstaller(PlatformSpawner platformSpawner, [InjectOptional] PlayerSpaceConvertor?playerSpaceConvertor, [InjectOptional] MultiplayerPlayersManager?multiplayerPlayersManager)
 {
     _platformSpawner           = platformSpawner;
     _multiplayerPlayersManager = multiplayerPlayersManager;
     if (playerSpaceConvertor is not null)
     {
         _obstacleSaberSparkleEffectManager = playerSpaceConvertor.GetComponentInChildren <ObstacleSaberSparkleEffectManager>();
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     m_PlatformSpawner = GetComponentInParent <PlatformSpawner>();
     if (m_PlatformSpawner == null)
     {
         Debug.Log("Platform spawner is null");
     }
     StartCoroutine(DisableAnimator());
     m_Animator.enabled = true;
 }
Example #15
0
 void Start()
 {
     sr              = player.GetComponent <SpriteRenderer> ();
     controller2d    = player.GetComponent <Controller2D> ();
     platformSpawner = gameObject.GetComponent <PlatformSpawner> ();
     playerStartPos  = player.transform.position;
     cameraStartPos  = camera.transform.position;
     gameOverUI.SetActive(false);
     platformSpawner.SpawnInitialPlatforms();
 }
 void Awake()
 {
     rb = GetComponent <Rigidbody2D>();
     if (maxDistance == 0.0f)
     {
         PlatformSpawner platformSpawner           = FindObjectOfType <PlatformSpawner>();
         float           halfPlatformSize          = platformSpawner.halfPlatformSize;
         float           activeFieldHorizontalSize = platformSpawner.GetActiveFieldHorizontalSize();
         maxDistance = activeFieldHorizontalSize - halfPlatformSize;
     }
 }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
    // Use this for initialization
    void Start()
    {
        // Get camera object and script
        camera       = GameObject.FindGameObjectWithTag("MainCamera");
        cameraScript = camera.GetComponent <CameraMovement>();
        // Get platform spawner object and script
        platSpawn       = GameObject.FindGameObjectWithTag("PlatformSpawner");
        platSpawnScript = platSpawn.GetComponent <PlatformSpawner>();

        // set initial jump force
        jumpForce = new Vector2(xScale, xScale * xyRatio);
    }
Example #19
0
    void Start()
    {
        scoreTrackerSc    = scoreTracker.GetComponent <ScoreTracker>();
        ballControllerSc  = ball.GetComponent <BallController>();
        platformSpawnerSc = platformSpawner.GetComponent <PlatformSpawner>();

        //Can not control the ball. The physics are not enabled untill
        //the game start
        Time.timeScale           = 0;
        ballControllerSc.enabled = false;

        InitializeSession();
    }
    private void Start()
    {
        levelGenerator = FindObjectOfType <LevelGenerator>();
        levelGenerator.GenerateLevel(map);
        spawnPoint = GameObject.Find("StartingPoint(Clone)").transform;
        liveAdded  = false;

        player = Instantiate(playerInst, spawnPoint.position, Quaternion.identity).GetComponent <Player>();

        platforms       = GameObject.FindGameObjectsWithTag("DestructiblePlatform");
        platformSpawner = FindObjectOfType <PlatformSpawner>();

        DecoratePlayer();
    }
Example #21
0
 // Start is called before the first frame update
 private void Start()
 {
     level = 1;
     spawnableIncrementor      = 2;
     currentSpawnablePlatforms = 5;
     tokensCollected           = new List <int>();
     IncrementLevelRequiredTokens();
     playerObject    = GameObject.FindGameObjectWithTag("Player");
     player          = playerObject.GetComponent <PlayerMover>();
     platformSpawner = GameObject.FindGameObjectWithTag("PlatformSpawner").GetComponent <PlatformSpawner>();
     UpdateUI();
     DisableGameOverMenu();
     DisablePauseMenu();
     DisableContinueMenu();
 }
Example #22
0
    int totalPlatforms = 30; // I would tie this to difficulty in a full version of the game, for now it's constant

    void Start()
    {
        if (psSingleton == null)
        {
            psSingleton = this;
        }
        else if (psSingleton != null)
        {
            Destroy(gameObject);
        }

        distanceToEnd = startPlatform.position.y - (endPlatform.position.y + extraSpace);//calculate distance of course

        startRotation = transform.eulerAngles;
        LoadPlatform();
    }
Example #23
0
    private Vector2 poolPosition = new Vector2(0, 25); // 초반에 생성된 발판들을 화면 밖에 숨겨둘 위치

    void Awake()
    {
        // 싱글톤 변수 instance가 비어있는가?
        if (instance == null)
        {
            // instance가 비어있다면(null) 그곳에 자기 자신을 할당
            instance = this;
        }
        else
        {
            // instance에 이미 다른 GameManager 오브젝트가 할당되어 있는 경우

            // 씬에 두개 이상의 GameManager 오브젝트가 존재한다는 의미.
            // 싱글톤 오브젝트는 하나만 존재해야 하므로 자신의 게임 오브젝트를 파괴
            Debug.LogWarning("씬에 두개 이상의 게임 매니저가 존재합니다!");
            Destroy(gameObject);
        }
    }
        private bool buildFinish;                //used to check if we finish building the levels

        #region Unity Callbacks

        private void Awake()
        {
            Application.targetFrameRate = 60;
            //Our singleton pattern
            if (instance != null && instance != this)
            {
                // destroy the gameobject if an instance of this exist already
                Destroy(gameObject);
            }
            else
            {
                //Set our instance to this object/instance
                Application.targetFrameRate = 60;
                instance = this;
                GameAnalytics.Initialize();
            }

            platformSpawner = GetComponent <PlatformSpawner>();
            levelFloatUp    = GetComponent <PlatformTransition>();
        }
Example #25
0
 private void Start()
 {
     animator        = GetComponent <Animator>();
     platformSpawner = FindObjectOfType <PlatformSpawner>();
     maxX           += transform.position.x;
     maxY           += transform.position.y;
     minX            = transform.position.x - minX;
     minY            = transform.position.y - minY;
     if (isMoving)
     {
         if (isMovingVertical && isMovingHorizontal)
         {
             actuallTarget = new Vector2(maxX, maxY);
         }
         else if (isMovingHorizontal)
         {
             actuallTarget = new Vector2(maxX, transform.position.y);
         }
         else if (isMovingVertical)
         {
             actuallTarget = new Vector2(transform.position.x, maxY);
         }
     }
 }
 void Start()
 {
     spawner = (PlatformSpawner)GameObject.Find("PlatformSpawner").GetComponent(typeof(PlatformSpawner));
 }
Example #27
0
 public void SetSpawner(PlatformSpawner spawn)
 {
     mySpawn = spawn;
 }
Example #28
0
 void OnDestroy()
 {
     Instance = null;
     Platforms = null;
 }
Example #29
0
 void Awake()
 {
     Instance = this;
     Platforms = new List<KeyValuePair<int, Platform>>();
 }
Example #30
0
 // Start is called before the first frame update
 void Awake()
 {
     spawner = GameObject.Find("PlatformSpawner").GetComponent <PlatformSpawner>();
 }
Example #31
0
 public PlatformsGameInstaller(PlatformSpawner platformSpawner, [InjectOptional] MultiplayerPlayersManager multiplayerPlayersManager)
 {
     _platformSpawner           = platformSpawner;
     _multiplayerPlayersManager = multiplayerPlayersManager;
 }
 void Start()
 {
     m_player          = GameObject.FindWithTag("Player");
     m_platformSpawner = GetComponent <PlatformSpawner>();
 }
Example #33
0
 private void Awake()
 {
     platformSpawner = GetComponent <PlatformSpawner>();
 }