示例#1
0
    // Use this for initialization
    void Start()
    {
        shooter = GameObject.Find("Shooter").GetComponent <Shooter>();

        // Determine what type of powerup this is
        potentialAbilities[0] = new ShrapnelBlast(shooter);
        potentialAbilities[1] = new ShrapnelBlast(shooter);
        potentialAbilities[2] = new FasterCamera(shooter);
        potentialAbilities[3] = new StopCamera(shooter);

        abilityGiven = potentialAbilities[Random.Range(0, potentialAbilities.Length)];

        renderer        = this.GetComponent <SpriteRenderer>();
        renderer.sprite = Resources.Load(abilityGiven.iconString, typeof(Sprite)) as Sprite;
    }
示例#2
0
    void Start()
    {
        runner         = GameObject.Find("Runner");
        energyBar      = GameObject.Find("EnergyBar").GetComponent <Slider>();
        rightClickUses = GameObject.Find("Right Click Uses").GetComponent <Text>();

        shootBullet    = new ShootBullet(this);
        spawnDog       = new SpawnDog(this);
        spawnBarricade = new SpawnBarricade(this);
        createMine     = new CreateMine(this);

        // Right click powerup abilities
        noRightClick  = new NoRightClick(this);
        shrapnelBlast = new ShrapnelBlast(this);
        explosives    = new Explosives(this);
        stopCamera    = new StopCamera(this);
        fasterCamera  = new FasterCamera(this);

        abilityList.AddLast(createMine);
        abilityList.AddLast(spawnBarricade);
        abilityList.AddLast(explosives);
        //abilityList.AddLast(stopCamera);
        //abilityList.AddLast(fasterCamera);
        //abilityList.AddLast(shrapnelBlast);
        abilityList.AddFirst(spawnDog);

        leftClickAbility   = shootBullet;
        middleClickAbility = createMine;
        rightClickAbility  = noRightClick;

        // Grab GUI icons
        middleClickText = GameObject.Find("Middle Click Icon").GetComponent <Image>();
        rightClickText  = GameObject.Find("Right Click Icon").GetComponent <Image>();

        middleClickText.sprite = Resources.Load(middleClickAbility.iconString, typeof(Sprite)) as Sprite;
        rightClickText.sprite  = Resources.Load(rightClickAbility.iconString, typeof(Sprite)) as Sprite;
    }