Exemple #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;
    }
Exemple #2
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);
        }
    }