Exemplo n.º 1
0
    public void SetSpawnersConfig()
    {
        Vector3 vector3 = new Vector3(0.0f, 3, 0);

        GameShapeType[] types         = { GameShapeType.CIRCLE, GameShapeType.SQUARE, GameShapeType.TRIANGLE };
        GameSpawner     spawnerModel1 = new GameSpawner(types, vector3);

        vector3 = new Vector3(2f, 3, 0);

        GameSpawner spawnerModel2 = new GameSpawner(types, vector3);

        vector3 = new Vector3(-2f, 3, 0);

        GameSpawner spawnerModel3 = new GameSpawner(types, vector3);

        GameSpawner[] spawnersModel = { spawnerModel1, spawnerModel2, spawnerModel3 };
        spawners = spawnersModel;

        if (onSpawnersUpdated != null)
        {
            onSpawnersUpdated(spawners);
        }

        StartSpawners();
    }
Exemplo n.º 2
0
 void Start()
 {
     boundaryCounter     = 0;
     leftBoundary        = GameObject.Find("LeftBoundary").transform;
     rightBoundary       = GameObject.Find("RightBoundary").transform;
     gameSpawnerVariable = GameObject.Find("GameSpawner").GetComponent <GameSpawner>();
 }
Exemplo n.º 3
0
 void Start()
 {
     submarine           = GetComponent <Rigidbody2D>();
     gameSpawnerVariable = GameObject.Find("GameSpawner").GetComponent <GameSpawner>();
     leftBoundary        = GameObject.Find("LeftBoundary").transform;
     rightBoundary       = GameObject.Find("RightBoundary").transform;
     tanks      = 2;
     lives      = 2;
     boostTimer = 3;
 }
Exemplo n.º 4
0
 public GameShape(GameShapeType type, GameSpawner spawner, float speed, float spawnSpeed)
 {
     PercentualTraveled = 0;
     Spawner            = spawner;
     this.Type          = type;
     this.Speed         = speed;
     SpawnSpeed         = spawnSpeed;
     this.Position      = spawner.SpawnPosition;
     State = GameShapeState.SPAWNING;
 }
    public static GameShapeSpawnerView CreateSpawnerView(GameObject spawnerPrefab, GameSpawner spawner, GameObject parent, GamePlumbingDragView gamePlumbingDragView, GamePlumbingController gamePlumbingController)
    {
        GameObject spawnerObj = Instantiate(spawnerPrefab, spawner.SpawnPosition, Quaternion.identity);

        spawnerObj.transform.parent = parent.transform;
        GameShapeSpawnerView component = spawnerObj.AddComponent <GameShapeSpawnerView>();

        component.InitSpawner(gamePlumbingDragView, gamePlumbingController, spawner);
        return(component);
    }
 public void SetPipeFromSpawner(GameSpawner spawner, GamePipeEnd pipeEnd)
 {
     if (spawner.AttachedPipe == null)
     {
         AddPipe(spawner, pipeEnd);
     }
     else
     {
         UpdatePipeEnd(spawner.AttachedPipe, pipeEnd);
     }
 }
    private GamePipe AddPipe(GameSpawner spawner, GamePipeEnd end)
    {
        GamePipe newPipe = new GamePipe(spawner, end);

        pipes.Add(newPipe);
        spawner.AttachPipe(newPipe);
        if (onPipeAdded != null)
        {
            onPipeAdded(newPipe);
        }
        return(newPipe);
    }
Exemplo n.º 8
0
    void Start()
    {
        gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>();

        spawn.Location = spawnLocation;
        spawn.timer = timer;

        if(!inGameUI.isLevel1)
        {
            StartBottles();
        }
    }
    public GameShape CreateShape(GameShapeType newShapeType, GameSpawner spawner, float speed, float spawnSpeed)
    {
        GameShape shape = new GameShape(newShapeType, spawner, speed, spawnSpeed);

        ShapePipePair newPair = new ShapePipePair
        {
            Shape = shape
        };

        Pairs.Add(newPair);

        return(shape);
    }
Exemplo n.º 10
0
    void Start()
    {
        gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>();

        if(!inGameUI.isLevel1)
        {
            if(!inGameUI.wave1)
            {
                StartCoroutine("WaveLabelEnableTimer" , "Wave1Label");
                Wave(wave1 , wave1SpawnLocations);
            }
        }
    }
Exemplo n.º 11
0
    private void Awake()
    {
        _canvas         = GetComponent <Canvas>();
        _canvas.enabled = false;
        _moneyText      = transform.Find("Panel").Find("You Made Text").GetComponent <Text>();

        money   = GameObject.FindObjectOfType <MoneyManager>();
        player  = GameObject.FindObjectOfType <Controller>();
        spawner = GameObject.FindObjectOfType <GameSpawner>();

        button = GetComponentInChildren <Button>();
        //environmentCanvas = GameObject.Find("World UI").GetComponent<Canvas>();
    }
Exemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        startPos  = GameObject.FindGameObjectWithTag("CameraStartPos").transform;
        endPos    = GameObject.FindGameObjectWithTag("CameraEndPos").transform;
        creditPos = GameObject.FindGameObjectWithTag("CameraCreditsPos").transform;
        camera    = GetComponent <Camera>();

        money      = GameObject.FindObjectOfType <MoneyManager>();
        player     = GameObject.FindObjectOfType <Controller>();
        spawner    = GameObject.FindObjectOfType <GameSpawner>();
        canvas     = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <Canvas>();
        menu       = GameObject.FindObjectOfType <MenuCanvas>();
        delayParam = delayTime / InterpTime;
    }
Exemplo n.º 13
0
 void OnSpawnersUpdated(GameSpawner[] spawners)
 {
     if (spawnerObjects != null)
     {
         foreach (GameObject spawner in spawnerObjects)
         {
             Destroy(spawner);
         }
     }
     spawnerObjects = new GameObject[spawners.Length];
     for (int i = 0; i < spawners.Length; i++)
     {
         GameSpawner spawn = spawners[i];
         spawnerObjects[i] = CreateSpawnerObject(spawn);
     }
 }
Exemplo n.º 14
0
 public void SetToState(GameState gameStateToSet)
 {
     if (_currentGameState == GameState.LoadingGame && gameStateToSet == GameState.OnGame)
     {
         _currentGameState = gameStateToSet;
         var gameSpawner = GameSpawner.FindInScene();
         gameSpawner.StartGame(_globalPlayers);
     }
     else if (_currentGameState == GameState.OnGame && gameStateToSet == GameState.OnWrapUpScreen)
     {
         _currentGameState = gameStateToSet;
     }
     else if (gameStateToSet == GameState.OnLobby)
     {
         _currentGameState = gameStateToSet;
     }
 }
Exemplo n.º 15
0
    protected void SpawnShape(GameSpawner spawner = null)
    {
        if (spawner == null)
        {
            int spawnerIndex = UnityEngine.Random.Range(0, spawners.Length);
            spawner = spawners[spawnerIndex];
        }

        GameShapeType newShapeType = spawner.GetRandomShapeType();

        GameShape shape = shapeController.CreateShape(newShapeType, spawner, speed, spawnSpeed);

        spawner.CurrentShapes++;

        shape.RegisterOnStateChanged(CallShapeStateChanged);

        if (onShapeCreated != null)
        {
            onShapeCreated(shape);
        }
    }
Exemplo n.º 16
0
        public override void OnInspectorGUI()
        {
            LoadingSetupTools loadingSetup = target as LoadingSetupTools;


            if (GUILayout.Button("Load"))
            {
                if (!loadingSetup.loadingSetup)
                {
                    Debug.LogError("Loading Setup is null.");
                }
                else
                {
                    GameObject world = GameObject.Find("World");
                    if (world)
                    {
                        DestroyImmediate(world);
                    }

                    GameSpawner gameSpawner = new GameSpawner(loadingSetup.loadingSetup);
                    loadingSetup.StartCoroutine(gameSpawner.Load(
                                                    (progress) => { }, () => { }));
                }
            }
            if (loadingSetup.loadingSetup)
            {
                if (GUILayout.Button("Save"))
                {
                    loadingSetup.loadingSetup.Trees  = FindWithTag("Trees");
                    loadingSetup.loadingSetup.Clouds = FindWithTag("Clouds");
                    loadingSetup.loadingSetup.Rocks  = FindWithTag("Rocks");

                    EditorUtility.SetDirty(loadingSetup.loadingSetup);
                    AssetDatabase.SaveAssets();
                }
            }

            base.OnInspectorGUI();
        }
Exemplo n.º 17
0
 private void CheckCanSpawn()
 {
     if (currentDelay >= delay)
     {
         GameSpawner spawner = GetRandomEmptySpawner();
         if (spawner != null)
         {
             NoOverlapSpawn(spawner);
         }
     }
     else
     {
         foreach (GameSpawner spawner in spawners)
         {
             if (spawner.CurrentShapes > 0)
             {
                 return;
             }
         }
         NoOverlapSpawn(null);
     }
 }
 private void InitSpawner(GamePlumbingDragView plumbingDragView, GamePlumbingController plumbingController, GameSpawner spawner)
 {
     gamePlumbingDragView   = plumbingDragView;
     gamePlumbingController = plumbingController;
     Spawner = spawner;
 }
Exemplo n.º 19
0
 void Start()
 {
     goldTimer           = goldLifespan;
     gameSpawnerVariable = GameObject.Find("GameSpawner").GetComponent <GameSpawner>();
 }
Exemplo n.º 20
0
 public GamePipe(GameSpawner spawner, GamePipeEnd startEnd)
 {
     this.spawner = spawner;
     pipeEnd      = startEnd;
     State        = GamePipeState.WRONG;
 }
Exemplo n.º 21
0
    void Start()
    {
        attackDelay = false;
        bottles = GameObject.Find("BottlesSpawner").GetComponent<BottlesSpawner>();
        buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>();
        enemySpawner = GameObject.Find("EnemySpawner").GetComponent<EnemySpawner>();
        gameOverObj = GameObject.FindGameObjectWithTag("GO");
        gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>();
        inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>();
        killed = false;
        nappyPad = GameObject.Find("NappyPadSpawner").GetComponent<NappyPadSpawner>().PF_NappyPad;
        nappyPadObj = GameObject.FindGameObjectWithTag("Ammo");

        if(nappyPadObj != null)
        {
            nappyPadScript = nappyPadObj.GetComponent<NappyPad>();
        }

        nappyPadShadow = GameObject.Find("NappyPadSpawner").GetComponent<NappyPadSpawner>().PF_NappyPadShadow;
        playerSpawn = GameObject.FindGameObjectWithTag("SpawnBlock").GetComponent<PlayerSpawn>();
        sm = GameObject.Find("SoundManager").GetComponent<SoundManager>();
        laugh = sm.laugh;

        SetState(0);
    }
Exemplo n.º 22
0
    void Start()
    {
        enemySpawnerObj = GameObject.Find("EnemySpawner");

        gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>();

        if(enemySpawnerObj != null)
        {
            enemySpawnerScript = enemySpawnerObj.GetComponent<EnemySpawner>();
        }

        nappyPadSpawnerObj = GameObject.Find("NappyPadSpawner");

        if(nappyPadSpawnerObj != null)
        {
            nappyPadSpawnerScript = nappyPadSpawnerObj.GetComponent<NappyPadSpawner>();
        }

        //Time.timeScale = 1;

        GameObject smobj = GameObject.Find("SoundManager");

        if(smobj != null)
        {
            Debug.Log("Sound Manager Found");
            sm = smobj.GetComponent<SoundManager>();
        }

        PF_Bottle = null;

        if(isLevel1)
        {
            StartCoroutine("AppearLabel" , "1. TomatoIcon");
            StartCoroutine("AppearLabel" , "PlayerCostLabel");
        }

        secondPlayer = false;
    }
Exemplo n.º 23
0
 public void AttachPipeToSpawner(GamePipe pipe, GameSpawner spawner)
 {
     spawner.AttachPipe(pipe);
 }
Exemplo n.º 24
0
    void Start()
    {
        igu = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>();
        menuButtonScript = FindObjectOfType<MenuButton>();
        PF_BroccoliBaby = Resources.Load("PF_BroccoliBaby") as GameObject;
        PF_Cow = Resources.Load("PF_Cow") as GameObject;
        PF_TomatoBaby = Resources.Load("PF_TomatoBaby") as GameObject;
        sm = GameObject.Find("SoundManager").GetComponent<SoundManager>();
        tomatoButtonImage = GameObject.Find("TomatoButton").GetComponent<Image>();

        if(gameSpawnScript == null)
        {
            gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>();
        }
    }
Exemplo n.º 25
0
 private void Start()
 {
     gs = GameObject.FindGameObjectWithTag("GameSpawner").GetComponent <GameSpawner>();
 }
Exemplo n.º 26
0
    void Start()
    {
        gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>();

        if(gameSpawnScript.level == 2)
        {
            cowButton = GameObject.Find("CowButton").GetComponent<Button>();
            cowTickImage = GameObject.Find("CowTick").GetComponent<Image>();
        }

        if(gameSpawnScript.level == 3)
        {
            broccoliButton = GameObject.Find("BroccoliButton").GetComponent<Button>();
            broccoliTickImage = GameObject.Find("BroccoliTick").GetComponent<Image>();
            cowButton = GameObject.Find("CowButton").GetComponent<Button>();
            cowTickImage = GameObject.Find("CowTick").GetComponent<Image>();
        }

        inGameUIObj = GameObject.Find("InGameUIManager");
        tomatoButton = GameObject.Find("TomatoButton").GetComponent<Button>();
        tomatoTickImage = GameObject.Find("TomatoTick").GetComponent<Image>();

        if(broccoliButton != null)
        {
            broccoliButtonColours = broccoliButton.colors;
        }

        if(cowButton != null)
        {
            cowButtonColours = cowButton.colors;
        }

        if(inGameUIObj != null)
        {
            inGameUIScript = inGameUIObj.GetComponent<InGameUIManager>();
        }

        if(tomatoButton != null)
        {
            tomatoButtonColours = tomatoButton.colors;
        }

        sm = GameObject.Find("SoundManager").GetComponent<SoundManager>();
    }
Exemplo n.º 27
0
 private void NoOverlapSpawn(GameSpawner spawner)
 {
     SpawnShape(spawner);
     currentDelay = 0;
     Invoke(CheckSpawnShapeFunction, delay);
 }
Exemplo n.º 28
0
 GameObject CreateSpawnerObject(GameSpawner spawner)
 {
     return(GameShapeSpawnerView.CreateSpawnerView(spawnerPrefab, spawner, spawnersParent, gamePlumbingDragView, gamePlumbingController).gameObject);
 }