示例#1
0
文件: MainGame.cs 项目: Whenti/GGJ20
    public void createMegaAmmoTuto()
    {
        Ammunition a = Ammunition.Instantiate(megaAmmoPrefab);

        a.transform.SetParent(Ammunitions.transform, false);

        a.transform.position = generatorMegaAmmo.position;
        a.is_tuto            = true;
    }
示例#2
0
文件: Player.cs 项目: Whenti/GGJ20
    void shoot()
    {
        if (ammo.Count > 0)
        {
            //if (timer_hold >= duration_hold) {
            if (ammo[ammo.Count - 1] == "mega_ammo")
            {
                //mega ammo

                Ammunition a = Ammunition.Instantiate(megaAmmoPrefab);
                a.transform.SetParent(mainGame.Ammunitions.transform, false);
                a.transform.position = transform.position + (aim_direction).normalized * distance_aim;
                a.setDirection(aim_direction);
                a.setShot(true);
            }
            else if (ammo[ammo.Count - 1] == "ammo")
            {
                //regular ammo

                Ammunition a = Ammunition.Instantiate(ammoPrefab);
                a.transform.SetParent(mainGame.Ammunitions.transform, false);
                a.transform.position = transform.position + (aim_direction).normalized * distance_aim;
                a.setDirection(aim_direction);
                a.setShot(true);
            }

            is_shooting = true;
            anim_shoot.start();
            this.GetComponent <AudioSource>().Play();

            ammo.RemoveAt(ammo.Count - 1);

            timer_hold = 0;
            hold_blast = false;
        }
        else
        {
            //cannot shoot ! no ammo
        }
    }
示例#3
0
文件: MainGame.cs 项目: Whenti/GGJ20
    public void createAmmo(string type)
    {
        Ammunition a = null;

        if (type == "ammo" && numberAmmo() < 50)
        {
            a = Ammunition.Instantiate(ammoPrefab);
        }
        else if (type == "mega_ammo" && numberMegaAmmo() < 50)
        {
            a = Ammunition.Instantiate(megaAmmoPrefab);
        }

        if (a != null)
        {
            a.transform.SetParent(Ammunitions.transform, false);

            int     index = Random.Range(0, Generators.transform.childCount);
            Vector3 pos   = Generators.transform.GetChild(index).transform.position;
            a.transform.position = pos;
        }
    }