Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (endCanvas != null)
        {
            endCanvas.enabled = false;
        }
        originalAttackDelay = fireDelay;
        colours             = GameStores.GetPlayerColours();
        //colours[0] = colourRGB;
        coloursSize = 1;
        colourRef   = 0;

        myBody = GetComponent <Rigidbody2D>();
        Debug.Log(myBody);
        movement = new Vector2();
        weapon   = GetComponent <Weapon>();
        base.Start();
        shieldModifier = GameStores.GetDefMod();

        health = GameStores.GetHealth();
        onDamage?.Invoke();

        fireDelay = GameStores.GetAtkMod();


        //attackColourRGB = colourRGB;
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        source = GetComponent <AudioSource>();
        switch (GameStores.GetDepth())
        {
        case 1:
            source.clip = clips[0];
            break;

        case 2:
            source.clip = clips[1];
            break;

        case 3:
            source.clip = clips[2];
            break;

        case 4:
            source.clip = clips[3];
            break;

        case 5:
            source.clip = clips[4];
            break;

        case 6:
            source.clip = clips[5];
            break;

        default:
            source.clip = clips[5];
            break;
        }
        source.Play();
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        title = titleText.gameObject;
        sub   = subText.gameObject;

        int depth = GameStores.GetDepth();


        titleText.text = "Level " + depth.ToString();
        if (depth < midBoss)
        {
            subText.text = "Midboss in " + (midBoss - depth).ToString() + (midBoss - depth == 1 ? " Stage" : " Stages");
        }
        else
        {
            subText.text = "Boss in " + (bigBoss - depth).ToString() + (bigBoss - depth == 1 ? " Stage" : " Stages");
        }


        states = new Dictionary <State, System.Action>();
        states.Add(State.MoveIn, MoveIn);
        states.Add(State.Stay, PosStay);
        states.Add(State.MoveOut, MoveOut);
        states.Add(State.Done, () =>
        {
            Destroy(gameObject);
        });
    }
Пример #4
0
    public void addColour(Vector3 newColour)
    {
        bool foundColour = false;

        //for (int reff = 0; reff < coloursSize; reff++)
        //{
        //    //if (colours[reff].x == newColour.x && colours[reff].y == newColour.y && colours[reff].z == newColour.z)
        //    //{
        //    //    setAttackColour(colours[reff]);
        //    //    colourRef = reff;
        //    //    foundColour = true;
        //    //}

        //    // Set colour and current colour index to the picked up value

        //}

        if (colours.Contains(newColour))
        {
            setColour(newColour);
            colourRef = colours.IndexOf(newColour);
        }
        else
        {
            colours.Add(newColour);
            GameStores.AddColour(newColour);
            AdjustColourRef(newColour);
            Debug.Log("COL: " + colours.Count);
            //tb.CreateText(transform.position.x, transform.position.y, "+ NEW COLOUR");
            SpawnText("+ NEW COLOUR");
            //colours[coloursSize] = newColour;
            //coloursSize++;
            //incrementColour();
        }
    }
    public void OnTriggerEnter2D(Collider2D collision)
    {
        //Debug.Log("TODO: GO TO NEXT DUNGEON!");
        SimplePlayer p = collision.gameObject.GetComponent <SimplePlayer>();

        //Debug.Log(p.health);
        GameStores.SetHealth(p.health);
        GameStores.SetDefMod(p.shieldModifier);
        GameStores.SetAtkMod(p.fireDelay);
        //Debug.Log(p.shieldModifier);
        GameStores.IncrementLength();
        GameStores.IncrementDepth();
        if (GameStores.GetDepth() == firstBoss)
        {
            SceneManager.LoadScene("BossWall");
        }
        else if (GameStores.GetDepth() == secondBoss)
        {
            SceneManager.LoadScene("BossHux");
        }
        else
        {
            SceneManager.LoadScene("Dungeon");
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        int length = GameStores.GetLength();

        // Create underlying maze.
        m = new Maze();
        m.Create(size);
        //m.MakeBoss(length);
        m.MakeRandomBoss();
        m.PopulateColourRooms(colourRooms);
        m.RemoveDeadEnds();
        m.AddCycles();
        m.SetRisk(length);

        startX = m.GetStart().getX();
        startY = m.GetStart().getY();

        BuildRoom(0, 0);
        screenScroll.SetOnMove(BuildRoom);

        if (showMaze)
        {
            minimap.DisplayMaze(m);
        }

        minimap.DrawRoom(m.GetStart());
    }
 public void PlayGame()
 {
     // do some scene loading stuff here
     //SceneManager.LoadScene("Dungeon");
     GameStores.ResetState();
     SceneManager.LoadScene("IntroScene");
     //print("Loading the scene!");
 }
Пример #8
0
 public void die()
 {
     if (!alreadyDead)
     {
         alreadyDead = true;
         gameObject.GetComponent <PlayerMovement>().enabled = false;
         gameObject.GetComponent <Animator>().SetBool("IsDead", true);
         GameStores.BreadQuantity -= GameStores.levelBread;
         GameStores.changeScene();
         gameObject.GetComponent <AudioSource>().Play();
         gameObject.GetComponent <Rigidbody2D>().velocity = new Vector3(0, gameObject.GetComponent <Rigidbody2D>().velocity.y, 0);
         StartCoroutine(respawn2());
     }
 }
    public void OnColourRoom(Room r)
    {
        Vector3 center = Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f));

        List <Color> c = GameStores.AvailableColours();

        if (c.Count > 0)
        {
            GameObject   g         = Instantiate(colourControls.colourPrefab, new Vector3(center.x, center.y, 0), Quaternion.identity);
            ColourPickup cp        = g.GetComponent <ColourPickup>();
            int          randColor = Random.Range(0, c.Count);
            cp.SetColour(c[randColor]);
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     GameStores.changeScene();
     for (int x = 0; x < canvas.Length; x++)
     {
         if (x == n)
         {
             canvas[x].enabled = true;
         }
         else
         {
             canvas[x].enabled = false;
         }
     }
 }
Пример #11
0
    // Start is called before the first frame update
    void Start()
    {
        SpriteRenderer sr        = GetComponent <SpriteRenderer>();
        int            completes = GameStores.getGameComplete();

        //int completes = 1;
        if (completes > 0)
        {
            sr.enabled = true;
        }
        else
        {
            sr.enabled = false;
        }
    }
Пример #12
0
    public void SpawnShooters(int capacity)
    {
        if (capacity == 0)
        {
            Debug.Log("No Risk");
            return;
        }
        while (capacity > 0)
        {
            ShooterRisk sr = PickShooter(capacity);
            if (sr.risk == -1)
            {
                // No valid choices
                return;
            }

            BulletRisk br = PickBullet(capacity);
            if (br.risk == -1)
            {
                // No valid choices
                return;
            }
            float xpos = Random.Range(minPos, maxPos);
            float ypos = Random.Range(minPos, maxPos);

            Vector3 screenPosition = Camera.main.ViewportToWorldPoint(new Vector3(xpos, ypos, 0));

            GameObject g = Instantiate(sr.prefab, new Vector3(screenPosition.x, screenPosition.y, 0), Quaternion.identity);

            StaticShooter ss = g.GetComponent <StaticShooter>();

            List <Vector3> playerColours = GameStores.GetPlayerColours();
            Vector3        col           = playerColours[Random.Range(0, playerColours.Count)];
            ss.setColour(col);
            ss.missile     = br.prefab;
            ss.dropOnDeath = drops;
            ss.dropChance  = dropChance;

            capacity -= Mathf.Max(sr.risk, br.risk);
        }
    }
 public void Start()
 {
     GameStores.changeScene();
 }
Пример #14
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     GameStores.ResetState();
     SceneManager.LoadScene(0);
 }
 // Start is called before the first frame update
 void Start()
 {
     GameStores.addGameComplete();
     StartCoroutine(changeScene());
 }