Inheritance: MonoBehaviour
示例#1
0
 void Start()
 {
     spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent <SpawnerScript>();
     player  = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
     target  = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     anim    = GetComponent <Animator>();
 }
示例#2
0
    void TriggerSpawn()
    {
        SpawnerScript.Spawn();

        spawnTime -= .3f;
        Invoke("TriggerSpawn", spawnTime);
    }
        private static IEnumerator World(SpawnerScript instance, int[] s, PlanetInfo planet)
        {
            if (GameScript.districtLevel == 0)
            {
                GameScript.districtLevel = 1;
            }
            MenuScript.player.GetComponent <NetworkView>().RPC("Invis", RPCMode.All, new object[0]);
            InstanceTracker.GameScript.fadeObj.SendMessage("fadeOut2");
            yield return(new WaitForSeconds(0.5f));

            MenuScript.player.SendMessage("Reset");
            GameScript.inInstance = false;
            instance.ship.SetActive(false);
            SpawnerScript.curBiome  = s[0];
            SpawnerScript.lastBiome = s[0];
            planet.InvokeOnGenerateWorld(instance, s);
            InstanceTracker.GameScript.TeleportPlayer(0);
            yield return(new WaitForSeconds(0.8f));

            instance.musicbox.SendMessage("PlayTune", SpawnerScript.curBiome);
            InstanceTracker.GameScript.fadeObj.SendMessage("fadeIn2");
            GameScript.wormBossCounter = 0;
            GameScript.hivemindCounter = 0;
            yield break;
        }
    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());
    }
示例#5
0
 void Start()
 {
     delay    = 10;
     height   = Screen.height / 2;
     gameOver = false;
     spawner  = this;
 }
 public static void Postfix(SpawnerScript __instance, int[] s, ref IEnumerator __result)
 {
     if (PlanetRegistry.Singleton[s[0]] is PlanetInfo planet && planet.GetEntryType() != PlanetType.SPECIAL)
     {
         __result = WorldWrapper(__result, __instance, s, planet);
     }
 }
示例#7
0
 private void Start()
 {
     if (GameObject.FindGameObjectWithTag("EnemySpawner") != null)
     {
         spawner = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent <SpawnerScript>();
     }
 }
示例#8
0
 // Use this for initialization
 void Start()
 {
     sampleSpawner             = FindObjectOfType <SpawnerScript> ();
     baseSpawnEverSecondsValue = sampleSpawner.spawnEverySeconds;
     spawners = FindObjectsOfType <SpawnerScript> ();
     player   = FindObjectOfType <PlayerScript> ().gameObject;
 }
示例#9
0
    public void reset()
    {
        if (endlessMode)
        {
            GameObject eList = GameObject.Find("Enemies");
            for (int i = 0; i < eList.transform.childCount; i++)
            {
                Destroy(eList.transform.GetChild(i).gameObject);
            }

            SpawnerScript spawner = GameObject.Find("Spawner").GetComponent <SpawnerScript>();
            spawner.spawnRate             = spawner.startSpawnRate;
            rupees                        = 0;
            mainPlayer.curHP              = 3;
            mainPlayer.transform.position = new Vector3(0, -2, 0);
        }
        if (storyMode)
        {
            GameObject eList = GameObject.Find("Enemies");
            for (int i = 0; i < eList.transform.childCount; i++)
            {
                Destroy(eList.transform.GetChild(i).gameObject);
            }

            SpawnerScript spawner = GameObject.Find("Spawner").GetComponent <SpawnerScript>();
            spawner.StopCoroutine("Story");
            spawner.storyReset            = true;
            rupees                        = 0;
            mainPlayer.curHP              = 3;
            mainPlayer.transform.position = new Vector3(0, -2, 0);
        }
    }
        private static IEnumerator WorldWrapper(IEnumerator worldRoutine, SpawnerScript instance, int[] s, PlanetInfo planet)
        {
            yield return(worldRoutine);

            planet.InvokeOnGenerateWorld(instance, s);
            yield break;
        }
示例#11
0
        private static IEnumerator TownWrapper(IEnumerator townRoutine, SpawnerScript instance, int[] s, PlanetInfo planet)
        {
            yield return(townRoutine);

            planet.InvokeOnGenerateTown(instance, s);
            yield break;
        }
示例#12
0
 // Update is called once per frame
 void Update()
 {
     if (SpawnerScript.GetSingleton().GetGameOver())
     {
         if (ownLaser != null)
         {
             Destroy(ownLaser);
         }
         Destroy(gameObject);
         return;
     }
     if (!FreezeTimeScript.GetFrozen())
     {
         if (life == 100)
         {
             ownLaser = Instantiate(laser, gameObject.transform.position + new Vector3(-15, 0, 0),
                                    Quaternion.identity) as GameObject;
             life--;
         }
         else if (life < 0)
         {
             Destroy(gameObject);
         }
         else
         {
             life--;
         }
     }
 }
示例#13
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Spawner")
     {
         hit     = true;
         spawner = other.gameObject.GetComponent <SpawnerScript> ();
     }
 }
示例#14
0
    private void Start()
    {
        theScore = 0;
        hp       = 5;
        gameOver = false;

        mySpawnerScript = GameObject.Find("spawner").GetComponent <SpawnerScript>();
    }
示例#15
0
        public void Setup()
        {
            GameObject prefab = Resources.Load <GameObject>("Prefabs/Game");

            theObject = Object.Instantiate(prefab);
            spawner   = Object.FindObjectOfType <SpawnerScript>();
            shoot     = theObject.GetComponentInChildren <PlayerShoot>();
        }
示例#16
0
 private void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <GrabObject>();
     if (GameObject.FindGameObjectWithTag("ItemSpawner") != null)
     {
         spawner = GameObject.FindGameObjectWithTag("ItemSpawner").GetComponent <SpawnerScript>();
     }
 }
示例#17
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Spawner")
     {
         hit = true;
         spawner = other.gameObject.GetComponent<SpawnerScript> ();
     }
 }
示例#18
0
 private void Start()
 {
     scoreScript       = FindObjectOfType <ScoreScript>();
     moveScript        = FindObjectOfType <MoveScript>();
     spawnerScript     = FindObjectOfType <SpawnerScript>();
     infiniScoreScript = FindObjectOfType <InfiniScoreScript>();
     carScript         = FindObjectOfType <CarScript>();
 }
示例#19
0
 void Start()
 {
     manager      = this.GetComponentInParent <SpawnerScript>();
     spriterender = this.GetComponent <SpriteRenderer>();
     highesttile  = manager.HighestTile;
     size         = manager.Size;
     hit          = false;
 }
示例#20
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        poolScript = GameObject.FindGameObjectWithTag("Data").GetComponent <PoolObjectScript>();
    }
 // Start is called before the first frame update
 public void Start()
 {
     recipeUI       = GameObject.Find("RecipeUI");
     bouncerSpawn   = GameObject.FindGameObjectWithTag("GameController").GetComponent <SpawnerScript>();
     scoreUI        = GameObject.Find("GameUI").GetComponent <ScoreUIScript>();
     recipeComplete = false;
     currentRecipe  = -1;
     DecideNextRecipe();
 }
示例#22
0
 void Awake()
 {
     _pool       = GameObject.FindGameObjectWithTag("PoolManager").GetComponent <PoolManager>();
     _menu       = GameObject.FindGameObjectWithTag("Menu").GetComponent <MenuScript>();
     _background = GameObject.FindGameObjectWithTag("Background").GetComponent <BackgroundScript>();
     _spawn      = GameObject.FindGameObjectWithTag("Spawner").GetComponent <SpawnerScript>();
     _score      = GameObject.FindGameObjectWithTag("Scoreboard").GetComponent <ScoreboardScript>();
     _credit     = GameObject.FindGameObjectWithTag("Creditboard").GetComponent <CreditBoardScript>();
 }
示例#23
0
 /**************************             network stuff                *****************************/
 public override void OnClientConnect(NetworkConnection conn)
 {
     connected = true;
     base.OnClientConnect (conn);
     Debug.Log ("client is connected");
     sendUserConnect ();
     mySpawner = spawners [idNum].GetComponent <SpawnerScript> ();
     otherSpawner = spawners [1 - idNum].GetComponent <SpawnerScript> ();
 }
示例#24
0
    // Use this for initialization
    void Start()
    {
        newTime = gameTime + 1;

        spawner = GetComponentInChildren <SpawnerScript>();

        // Needs adjustment for actual play, just for testing at the moment
        Cursor.lockState = CursorLockMode.Locked;
    }
 public void SetStats(int pl, float s, SpawnerScript spawn, GameObject playObj)
 {
     p         = pl;
     Spawner   = spawn;
     speed     = s;
     Player    = playObj;
     direction = (Player.transform.position - this.transform.position).normalized;
     isAttack  = true;
 }
 public static bool Prefix(SpawnerScript __instance, ref int[] s)
 {
     if (!GadgetNetwork.MatrixReady && GadgetNetwork.GetTimeSinceConnect() < GadgetNetwork.MatrixTimeout)
     {
         __instance.StartCoroutine(GadgetUtils.WaitAndInvoke(RPCMethod, GadgetNetwork.MatrixTimeout - GadgetNetwork.GetTimeSinceConnect(), () => GadgetNetwork.MatrixReady, __instance, s));
         return(false);
     }
     GadgetNetwork.ConvertIDToLocal(PlanetRegistry.Singleton, ref s[0]);
     return(true);
 }
示例#27
0
 void Start()
 {
     blasterRef     = Resources.Load("Blaster");
     animator       = GetComponent <Animator>();
     rigidbody      = GetComponent <Rigidbody2D>();
     gameplayScript = GetComponent <GameplayScript>();
     spawnerScript  = GetComponent <SpawnerScript>();
     needRespawn    = false;
     isGameOver     = false;
 }
        public IEnumerator CheckForSpawningNegativeY()
        {
            SpawnerScript spawnerScript = GameObject.Find("GameManager").GetComponent <SpawnerScript>();

            int initialCount = 0;

            yield return(new WaitForSeconds(2f));

            Assert.Greater(spawnerScript.EnemyCountNegY, initialCount);
        }
 public static bool Prefix(SpawnerScript __instance, int[] s, ref IEnumerator __result)
 {
     PlanetRegistry.PlanetSelectorPage = 1;
     if (PlanetRegistry.Singleton[s[0]] is PlanetInfo planet && planet.GetEntryType() == PlanetType.SPECIAL)
     {
         __result = World(__instance, s, planet);
         return(false);
     }
     return(true);
 }
    // Start is called before the first frame update
    void Start()
    {
        rb = gameObject.GetComponent <Rigidbody2D>();

        //Get reference to spawner objects
        if (GameObject.FindGameObjectWithTag("EnemySpawner") != null)
        {
            spawner = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent <SpawnerScript>();
        }
    }
示例#31
0
 // Start is called before the first frame update
 void Start()
 {
     background = GameObject.CreatePrimitive(PrimitiveType.Cube);
     background.transform.position   = new Vector3(transform.position.x, transform.position.y, transform.position.z);
     background.transform.parent     = transform;
     background.transform.localScale = new Vector3(200, 200, 1);
     gameboard = Instantiate(boardPrefab, transform);
     gameboard.transform.localPosition = new Vector3(0, -6, -10);
     spawnerScript = gameboard.GetComponentInChildren <SpawnerScript>();
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
    // Use this for initialization
    void Start()
    {
        HighScore = gameObject.GetComponentsInChildren<Text>()[0];
        CurrentScore = gameObject.GetComponentsInChildren<Text>()[1];
        Lives = gameObject.GetComponentsInChildren<Text>()[2];

        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<SpawnerScript>();

        highScoreValue = PlayerPrefs.GetInt(highScoreKey, 0);

        SetScoreDisplay();
    }
示例#34
0
    void Start()
    {
        GameObject playerHealthObject = GameObject.FindWithTag ("HealthKeeper");
        if (playerHealthObject != null) {
            healthKeeper = playerHealthObject.GetComponent <HealthKeeper> ();
        }
        if (healthKeeper == null) {
            Debug.Log ("Can't find 'HealthKeeper' script");
        }

        spawnerScript = GetComponent<SpawnerScript> ();
        PlayAgainButton ();
    }
示例#35
0
    void Start()
    {
        spawner = GameObject.FindGameObjectWithTag("GameController").GetComponent<SpawnerScript>();

        springs = new Spring[springCount];
        triangles = new int[springCount * 6];
        uvs = new Vector2[springCount * 4];
        vertices = new Vector3[springCount * 4];

        for (int i = 0; i < springCount; ++i)
        {
            springs[i] = new Spring();
        }

        int j = 0;

        for (int i = 0; i < springCount * 6; )
        {
            triangles[i] = j;
            triangles[i + 1] = j + 1;
            triangles[i + 2] = j + 2;
            triangles[i + 3] = j;
            triangles[i + 4] = j + 2;
            triangles[i + 5] = j + 3;

            j += 4;
            i += 6;
        }

        for (int i = 0; i < springCount * 4; i += 4)
        {
            uvs[i] = new Vector2(1, 1);
            uvs[i + 1] = new Vector2(0, 1);
            uvs[i + 2] = new Vector2(1, 0);
            uvs[i + 3] = new Vector2(0, 0);
        }

        for (int i = 1; i < springCount; ++i)
        {
            vertices[(i - 1) * 4]     = new Vector3(0 - ((float)springCount / 8.0f) + ((float)(i - 1) / 4.0f), springs[i - 1].height, 0);
            vertices[(i - 1) * 4 + 1] = new Vector3(0 - ((float)springCount / 8.0f) + ((float)(i) / 4.0f), springs[i].height, 0);
            vertices[(i - 1) * 4 + 2] = new Vector3(0 - ((float)springCount / 8.0f) + ((float)(i) / 4.0f), -5.5f, 0);
            vertices[(i - 1) * 4 + 3] = new Vector3(0 - ((float)springCount / 8.0f) + ((float)(i - 1) / 4.0f), -5.5f, 0);
        }

        mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        mesh.vertices = vertices;
        mesh.uv = uvs;
        mesh.triangles = triangles;
    }
示例#36
0
    void Start()
    {
        targetPos = new Vector3(0, -3, 0);

        spawnerScript = spawnerObject.GetComponent<SpawnerScript>();
    }
 //Automatically run when a scene starts
 void Awake()
 {
     //other scripts to start..
     GameObject respawn = GameObject.FindWithTag ("Respawn");
     mySpawnerScript = respawn.GetComponent<SpawnerScript>();
     GameObject player = GameObject.FindWithTag ("Player");
     myPlayerScript = player.GetComponent<PlayerScript>();
 }