コード例 #1
0
ファイル: PaintballSpawner.cs プロジェクト: GillianYue/Bubbla
    public GameObject genPaintball(PaintballBehavior.ColorMode c, float x, float y, float z)
    {
        GameObject pb = genPaintball(x, y, z);

        pb.GetComponent <PaintballBehavior>().setColor(c);
        return(pb);
    }
コード例 #2
0
ファイル: MyBullet.cs プロジェクト: GillianYue/Bubbla
    //also instantiates trail of the corresponding color here
    public void setBulletColor(PaintballBehavior.ColorMode col)
    {
        Color c = PaintballBehavior.colorDict[col];

        GetComponent <SpriteRenderer>().color = c;
        myColor = col;

        switch (myColor)
        {
        case PaintballBehavior.ColorMode.RED:
            trailPrefab = prefabHolder.palletTrailRed;
            break;

        case PaintballBehavior.ColorMode.BLUE:
            trailPrefab = prefabHolder.palletTrailBlue;
            break;

        case PaintballBehavior.ColorMode.YELLOW:
            break;

        default:
            trailPrefab = prefabHolder.palletTrail;
            break;
        }

        trail = Instantiate(trailPrefab, gameObject.transform.position,
                            trailPrefab.transform.rotation) as GameObject;

        /*        trail.transform.parent = gameObject.transform;
         *      trail.transform.localScale = Vector3.one;*/
        trail.GetComponent <TrailFollowBall>().setMyBullet(gameObject);
    }
コード例 #3
0
ファイル: Player.cs プロジェクト: GillianYue/Bubbla
    public bool addPaint(PaintballBehavior.ColorMode c, int capacity)
    {
        //first check for space within slots that are already occupied
        int remainder = capacity;         //indicates extra amount that might/not be added as a new slot of the same color

        if (bulletGauge.Count != 0)
        {
            for (int index = 0; index < bulletGauge.Count; index++)
            {
                if (c.Equals(bulletGauge[index]))
                {
                    remainder = incrementGaugeCapacity(index, remainder);
                    if (remainder == 0)
                    {
                        break;
                    }
                }
            }
        }

        if (bulletGauge.Count < bulletGaugeCapacity)
        {
            if (remainder != 0)
            {
                bulletGauge.Add(c);                 //means no same color found/no space left --> definitely needs a new slot --> and there is a new slot
                int index = bulletGauge.Count - 1;

                setGaugeContent(index, remainder);
                addPaintSprite(PaintballBehavior.colorDict[c]);
            }
            return(true);
        }
        else
        {
            print("bulletGauge full");
            return(false);
        }
    }