Пример #1
0
 void Start()
 {
     gm         = FindObjectOfType <GameManager>();
     spawner    = FindObjectOfType <BoxSpawner>();
     controller = FindObjectOfType <PlayerController>();
     PlayTutorial();
 }
Пример #2
0
    void Update()
    {
        if (boxSpawner == null)
        {
            boxSpawner = GameObject.Find("BoxSpawner");
        }
        else if (boxSpawnerScript == null)
        {
            boxSpawnerScript = boxSpawner.GetComponent <BoxSpawner>();
        }

        /*if(Input.GetKeyDown(KeyCode.L)){
         *      //slimes
         *      if (spikeballs.Length > 0) {
         *              Debug.Log((spikeballs.Length) + " SpikeBalls found.");
         *      }else{
         *              Debug.Log("Spikeballs Length = 0.");
         *      }
         *      //wingmen
         *      //doors
         *      //keys
         * }*/

        if (Application.loadedLevel != currentLevel)         //Find All GameObjects in this level but search only once per level
        {
            findObjects();
            currentLevel = Application.loadedLevel;
        }
    }
Пример #3
0
 void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #4
0
    void Awake()
    {
        base.Awake();

        instance = this;
        spawnTime = 1.0f;
        spawnPosition = new Vector3 (transform.position.x, 25, transform.position.z);
    }
Пример #5
0
    void Awake()
    {
        base.Awake();

        instance      = this;
        spawnTime     = 1.0f;
        spawnPosition = new Vector3(transform.position.x, 25, transform.position.z);
    }
Пример #6
0
        public MainMenu(ScreenManager manager)
        {
            cam.Zoom = 5;
            cam.Pos  = new Vector2(GameConstants.MAP_SIZE_HORIZONTAL * GameConstants.TILE_SIZE / 2, GameConstants.MAP_SIZE_VERTICAL * GameConstants.TILE_SIZE / 2);
            Microsoft.Xna.Framework.Media.MediaPlayer.Stop();
            for (int i = 0; i < GameConstants.MAP_SIZE_HORIZONTAL; i++)
            {
                for (int j = 0; j < GameConstants.MAP_SIZE_VERTICAL; j++)
                {
                    tiles[i, j] = new Tile(ContentChest.Instance.floor[0], i * GameConstants.TILE_SIZE, j * GameConstants.TILE_SIZE);

                    if (j == GameConstants.MAP_SIZE_VERTICAL - 1 || j == 0)
                    {
                        if (i == GameConstants.MAP_SIZE_HORIZONTAL - 1 || i == 0)
                        {
                            BoxSpawner mover = new BoxSpawner(i * GameConstants.TILE_SIZE, j * GameConstants.TILE_SIZE);
                            entities.Add(mover);
                        }
                        else
                        {
                            BoxMover mover = null;
                            if (j == 0)
                            {
                                mover = new BoxMover(i * GameConstants.TILE_SIZE, j * GameConstants.TILE_SIZE, BoxMover.Type.item);
                            }
                            else if (j == GameConstants.MAP_SIZE_VERTICAL - 1)
                            {
                                mover = new BoxMover(i * GameConstants.TILE_SIZE, j * GameConstants.TILE_SIZE, BoxMover.Type.box);
                            }
                            mover.breakable = false;
                            entities.Add(mover);
                        }
                    }
                }
            }

            // Font for the footer.
            font = ContentChest.Instance.defaultFont;

            // Saves big parameters in the button initialising.
            int middleScreen = GameConstants.GAME_WIDTH / 2 - ContentChest.Instance.buttons[0].Width / 2;
            int buttonYStart = GameConstants.GAME_HEIGHT / 2;

            // Initialising all of the buttons.
            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i]    = new Button(ContentChest.Instance.buttons[i], new Vector2(middleScreen, buttonYStart), (ButtonTag)i);
                buttonYStart += buttonPadding + ContentChest.Instance.buttons[i].Height;
            }

            // Positioning of the footer string.
            ludumStringX   = GameConstants.GAME_WIDTH / 2 - (int)font.MeasureString(ludumString).X / 2;
            ludumStringY   = GameConstants.GAME_HEIGHT - (int)font.MeasureString(ludumString).Y - 10;
            ludumStringPos = new Vector2(ludumStringX, ludumStringY);

            this.manager = manager; // For access to screen changing.
        }
 private void Start()
 {
     EG          = FindObjectOfType <EquationGen>().GetComponent <EquationGen>();
     timer       = FindObjectOfType <Timer>();
     spwn        = GameObject.Find("SpawnEngine").GetComponent <BoxSpawner>();
     stmp        = GameObject.Find("UI Screens").GetComponent <StampGen>();
     scre        = GameObject.Find("Score Bar").GetComponent <Score>();
     tape        = GetComponent <Tape>();
     changeColor = false;
 }
Пример #8
0
    private void Start()
    {
        wepText = GameObject.Find("WeaponBoxText").GetComponent <Text>();
        rb      = GetComponent <Rigidbody2D>();
        bS      = GameObject.FindWithTag("BoxL").GetComponent <BoxSpawner>();

        Enemy enem = GameObject.Find("Enemy").GetComponent <Enemy>();

        enem.goToPackage = true;
    }
Пример #9
0
    void Awake()
    {
        myAnim         = GetComponent <Animator>();
        myRigidbody    = GetComponent <Rigidbody2D>();
        bgScroller     = GameObject.Find("Background").GetComponent <BGScroller>();
        groundScroller = GameObject.Find("Ground").GetComponent <GroundScroller>();
        boxSpawner     = GameObject.Find("BoxSpawner").GetComponent <BoxSpawner>();

        Physics2D.IgnoreCollision(boxCollider, polygonCollider, true);
    }
Пример #10
0
 void Start()
 {
     if (boxSpawner == null)
     {
         boxSpawner = GameObject.Find("BoxSpawner");
     }
     else if (boxSpawnerScript == null)
     {
         boxSpawnerScript = boxSpawner.GetComponent <BoxSpawner>();
     }
 }
Пример #11
0
    void Start()
    {
        instance = this;

        col = GetComponent <BoxCollider>();

        halfX = col.size.x / 2;
        halfY = col.size.y / 2;
        halfZ = col.size.z / 2;

        SpawnBox(false);
        SpawnBox(false);
        SpawnBox(false);
    }
Пример #12
0
    void Start()
    {
        wepText            = GameObject.Find("WeaponBoxText").GetComponent <Text>();
        sR                 = GetComponent <SpriteRenderer>();
        bC                 = GetComponent <BoxCollider2D>();
        rB                 = GetComponent <Rigidbody2D>();
        bS                 = GameObject.FindWithTag("BoxL").GetComponent <BoxSpawner>();
        weaponHolderPlayer = GameObject.FindGameObjectWithTag("WeaponHolderPlayer").GetComponent <Transform>();
        weaponHolderEnemy  = GameObject.FindGameObjectWithTag("WeaponHolderEnemy").GetComponent <Transform>();


        Enemy enem = GameObject.Find("Enemy").GetComponent <Enemy>();

        enem.goToPackage = true;
    }
Пример #13
0
    // Use this for initialization
    void Start()
    {
        ActivCanavs = false;
        ESCPnl.SetActive(ActivCanavs);
        if (boxSpawner == null)
        {
            Debug.LogError("cant find box spawner Scaning scene to find it");
            var Bs = GameObject.FindGameObjectWithTag("BoxSpawner");
            boxSpawner = Bs.GetComponent <BoxSpawner>();
        }
        SpawnPlayer();

        // 3 Sek wait before start
        Invoke("StartBoxSpawner", 2f);
        //StartBoxSpawner();
    }
Пример #14
0
    void Start()
    {
        width  = Random.Range(0.75f, 1.25f);
        height = Random.Range(0.75f, 1.25f);
        mass   = Mathf.RoundToInt(Random.Range(5, 15));

        this.transform.localScale = new Vector3(width, width, height);
        rb      = GetComponent <Rigidbody>();
        rb.mass = mass;

        massText      = GameObject.Find("Mass").GetComponent <Text>();
        massText.text = "Mass of Mirror Box: " + mass;

        boxSpawner = GameObject.FindObjectOfType <BoxSpawner>();
        this.transform.SetParent(boxSpawner.transform);

        this.transform.position = new Vector3(transform.position.x, height / 2f + 0.1f, transform.position.z);

        objects   = this.GetComponent <Objects>();
        character = FindObjectOfType <Character>();
    }
Пример #15
0
 private void Awake()
 {
     instance = this;
 }
Пример #16
0
 private void Start()
 {
     spawner = FindObjectOfType <BoxSpawner>();
     gm      = FindObjectOfType <GameManager>();
 }