Inheritance: MonoBehaviour
 public void AddCollectable(Collectable genericCollectable)
 {
     CollectablesCollectionManger.CollectableEntities.Add(genericCollectable);
     Game.CollectablesDrawingManager.DrawableEntities.Add(genericCollectable);
     CollectablesUpdateManger.UpdatableEntities.Add(genericCollectable);
     Collectables.Add(genericCollectable);
 }
Beispiel #2
0
 protected virtual void Awake()
 {
     ChangeState(EnemyState.Idle);
     currHealth = maxHealth;
     shooter    = GetComponent <FireProjectiles>();
     newItem    = GetComponent <Collectables>();
 }
Beispiel #3
0
    void Start()
    {
        collectables = CollectablesInstance.GetComponent <Collectables>();
        player       = PlayerInstance.GetComponent <Player>();

        StartPlaying();
    }
        private void RemoveCollectedCollectables()
        {
            // Remove Collected Collectables
            for (Int32 index = 0; index < Collectables.Count; index++)
            {
                if (Collectables[index].IsCollected)
                {
                    CollectablesCollectionManger.CollectableEntities.Remove(Collectables[index]);
                    Game.CollectablesDrawingManager.DrawableEntities.Remove(Collectables[index]);
                    CollectablesUpdateManger.UpdatableEntities.Remove(Collectables[index]);
                    switch (Collectables[index].CollectionEntityType)
                    {
                    case CollectableEntityType.Health: HealthCollectablesSpawned--; break;

                    case CollectableEntityType.Gasoline: GasolineCollectablesSpawned--; break;

                    case CollectableEntityType.PistolAmmo: PistolAmmoCollectablesSpawned--; break;

                    case CollectableEntityType.ShotgunAmmo: ShotgunAmmoCollectablesSpawned--; break;

                    case CollectableEntityType.Energy: EnergyCollectablesSpawned--; break;

                    default: break;
                    }
                    Collectables.Remove(Collectables[index]);
                }
            }
        }
Beispiel #5
0
    public void SetTypeCollected(Collectables type)
    {
        switch (type)
        {
        case Collectables.Battery:
            _onPickBattery.Invoke();
            break;

        case Collectables.Bottle:
            _onPickBottle.Invoke();
            break;

        case Collectables.Card:
            _onPickCard.Invoke();
            break;

        case Collectables.Cereal:
            _onPickCereal.Invoke();
            break;

        case Collectables.Thrash:
            _onPickTrash.Invoke();
            break;

#if UNITY_EDITOR
        default:
            Debug.LogError("Han?");
            break;
#endif
        }
    }
Beispiel #6
0
 internal void DrawOnShiftInterface(ShiftInterface shiftInterface)
 {
     Particles.ForEach(p => shiftInterface.drawOnOverlay(p));
     Projectiles.ForEach(p => shiftInterface.drawOnOverlay(p));
     Collectables.ForEach(c => shiftInterface.drawOnOverlay(c));
     Enemies.ForEach(e => shiftInterface.drawOnOverlay(e));
     shiftInterface.drawOnOverlay(MainPlayer);
 }
Beispiel #7
0
 private void Start()
 {
     collectablesScript    = FindObjectOfType <Collectables>();
     scoreManagerScript    = FindObjectOfType <ScoreManager>();
     explosionEffectPrefab = Resources.Load("VFX/Explosion Particles") as GameObject;
     shotCounter           = Random.Range(minTimeBetweenShots, maxTimeBetweenShots);
     spaceShip             = GameObject.Find("Player");
 }
Beispiel #8
0
    void Awake()
    {
        GameObject gb = GameObject.FindGameObjectWithTag("EnemySpawnGameObject");

        enemiesScript = gb.GetComponent <Enemies>();
        score         = GameObject.FindGameObjectWithTag("Score").GetComponent <Score>();

        collectables = GameObject.FindGameObjectWithTag("Collectables").GetComponent <Collectables> ();
    }
 // Start is called before the first frame update
 void Start()
 {
     Random.InitState(System.DateTime.Now.Millisecond);
     c = GetComponent <Collectables>();
     for (int i = 0; i < numberOfObjectsInScene; i++)
     {
         addObject();
     }
 }
Beispiel #10
0
    private void Start()
    {
        collectables = new Collectables();
        Debug.Assert(collectables != null);
        collectables._grade    = MagicGrade.Diamond;
        collectables._duration = BonusDuration.Instant;

        UberDebug.LogChannel("Collectable", "Launch");
    }
Beispiel #11
0
 // Use this for initialization
 void Start()
 {
     Player            = GameObject.FindGameObjectWithTag("Player");
     Camera            = GameObject.FindGameObjectWithTag("MainCamera");
     CollectableScript = Player.GetComponent <Collectables>();
     CamScript         = Camera.GetComponent <NewCameraScript>();
     Menu.SetActive(false);
     Time.timeScale = 1;
 }
Beispiel #12
0
 internal void DrawObjects(Camera camera)
 {
     Map.DrawTiles(camera);
     Particles.ForEach(p => camera.Draw(p));
     Projectiles.ForEach(p => camera.Draw(p));
     Collectables.ForEach(c => camera.Draw(c));
     Enemies.ForEach(e => camera.Draw(e));
     camera.Draw(MainPlayer);
 }
Beispiel #13
0
 public void Collect(Collectables collected)
 {
     switch (collected.CollectableType)
     {
     case "BookPage":
         UnlockSpell(BookPages.PagesCollected);
         break;
     }
 }
Beispiel #14
0
 internal void DrawMinimap(Camera camera)
 {
     Map.DrawMap(camera);
     Particles.ForEach(p => camera.DrawMinimap(p));
     Projectiles.ForEach(p => camera.DrawMinimap(p));
     Collectables.ForEach(c => camera.DrawMinimap(c));
     Enemies.ForEach(e => camera.DrawMinimap(e));
     camera.DrawMinimap(MainPlayer);
 }
Beispiel #15
0
        private async Task <bool> HandleCollectable()
        {
            var required = CollectabilityValue;
            var itemName = string.Empty;

            if (!string.IsNullOrWhiteSpace(Collectables.First().Name))
            {
                var item = SelectYesNoItem.Item;
                if (item == null ||
                    !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var ticks = 0;
                    while ((item == null
                            ||
                            !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase))) &&
                           ticks++ < 60 && Behaviors.ShouldContinue)
                    {
                        item = SelectYesNoItem.Item;
                        await Coroutine.Yield();
                    }

                    if (ticks > 60)
                    {
                        required = (uint)Collectables.Select(c => c.Value).Max();
                    }
                }

                if (item != null)
                {
                    itemName = item.EnglishName;
                    var collectable = Collectables.FirstOrDefault(c => string.Equals(c.Name, item.EnglishName));

                    if (collectable != null)
                    {
                        required = (uint)collectable.Value;
                    }
                }
            }

            var value = SelectYesNoItem.CollectabilityValue;

            if (value >= required)
            {
                Logger.Info(Localization.ExFish_Collecting, itemName, value, required);
                SelectYesNoItem.Yes();
            }
            else
            {
                Logger.Info(Localization.ExFish_Declining, itemName, value, required);
                SelectYesNoItem.No();
            }

            await Coroutine.Wait(3000, () => !SelectYesNoItem.IsOpen);

            return(true);
        }
    private void Awake()
    {
        GameObject gaOb = GameObject.FindGameObjectWithTag("EnemySpawnGameObject");

        this.enemiesScript = gaOb.GetComponent <Enemies>();

        this.collectables = GameObject.FindGameObjectWithTag("Collectables").GetComponent <Collectables>();

        this.score = GameObject.FindGameObjectWithTag("Score").GetComponent <Score>();
    }
Beispiel #17
0
    public void QuitMenu()
    {
        move2D       = gameObject.GetComponent <Move2D>();
        collectables = gameObject.GetComponent <Collectables>();
        SaveSystem.SavePlayer(move2D, collectables);

        SceneManager.LoadScene(0);
        inventory.SetActive(false);
        quitconfrim.SetActive(false);
    }
Beispiel #18
0
 public void DeleteTheCollectable(Collectables c)
 {
     foreach (GameObject gO in CollectablesInScene)
     {
         if (gO.GetComponent <Collectable>().myCollectableType == c)
         {
             Destroy(gO);
         }
     }
 }
Beispiel #19
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <PlatformerCharacter2D> () == null)
        {
            return;
        }

        Collectables.AddPoints(pointsToAdd);
        NutSoundEffect.Play();
        Destroy(gameObject);
    }
Beispiel #20
0
 public void UnlockNewHostage(Hostage hostage)
 {
     CloseHostageDisplay();
     unlockInfoDisplay.transform.Find("Name").GetComponent <Text>().text      = hostage.name;
     unlockInfoDisplay.transform.Find("Image").GetComponent <Image>().sprite  = hostage.getSprite();
     unlockInfoDisplay.transform.Find("Backstory").GetComponent <Text>().text = hostage.background;
     Collectables.UnlockedHostages.Add(hostage);
     Collectables.SaveCollectables();
     UnpauseGame(false);
     unlockInfoDisplay.SetActive(true);
 }
Beispiel #21
0
        public void AddCollections(Dictionary <string, int> dic)
        {
            var colle = Collectables.ToSafe();

            foreach (var(name, count) in dic)
            {
                colle[name] += count;
            }

            Collectables = colle.Data;
        }
Beispiel #22
0
 // Use this for initialization
 void Start()
 {
     Door              = GameObject.FindGameObjectWithTag("Door");
     Sword             = GameObject.FindGameObjectWithTag("Sword");
     attackScript      = Sword.GetComponent <AttackScript>();
     Collectable       = GameObject.FindGameObjectWithTag("Player");
     CollectableScript = Collectable.GetComponent <Collectables>();
     menu.SetActive(false);
     ShopText.SetActive(false);
     ShopCam.SetActive(false);
     DoorCam.SetActive(false);
 }
Beispiel #23
0
    public static void SavePlayer(Move2D move2D, Collectables collectables)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string     path   = Application.persistentDataPath + "/player.sd"; // itt lehet tetszõleges filekiterjesztés
        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(move2D, collectables);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Beispiel #24
0
    // Update is called once per frame
    void Update()
    {
        if (HP <= 0)
        {
            Collectables.AddPoints(pointsOnDeath);
            Destroy(gameObject);

            if (gameObject.name == "Jarbas")
            {
                Application.LoadLevel(mainMenu);
            }
        }
    }
Beispiel #25
0
    private void CollectionDriver(Collectables coll)
    {
        if (data.obtainedCollectables.ContainsKey(currentScene.ToString()))
        {
            data.obtainedCollectables[currentScene.ToString()].Add(coll);
            //Remove Duplicates from list to mimic set
            data.obtainedCollectables[currentScene.ToString()] = data.obtainedCollectables[currentScene.ToString()].Distinct().ToList();
        }

        else
        {
            data.obtainedCollectables.Add(currentScene.ToString(), new List <Collectables> {
                coll
            });
        }
    }
Beispiel #26
0
    public PlayerData(Move2D move2D, Collectables collectables)
    {
        whiteSkin  = collectables.whiteSkinSAVE;
        yellowSkin = collectables.yellowSkinSAVE;
        redSkin    = collectables.redSkinSAVE;
        blueSkin   = collectables.blueSkinSAVE;
        greenSkin  = collectables.greenSkinSAVE;
        pinkSkin   = collectables.pinkSkinSAVE;
        cyanSkin   = collectables.cyanSkinSAVE;

        position = new float[3];

        position[0] = move2D.transform.position.x;
        position[1] = move2D.transform.position.y;
        position[2] = move2D.transform.position.z;
    }
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            if (MetroFramework.MetroMessageBox.Show(this, "Are you sure?", "Delete Loan", MessageBoxButtons.YesNo,
                                                    MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                string token = txtLoanId.Text.Substring(4);
                int    _id   = int.Parse(token);
                await loans.Delete(_id);

                Collectables c  = new Collectables();
                Collections  c2 = new Collections();
                c.DeleteCollectables(_id);
                c2.DeleteCollections(_id);
                MetroFramework.MetroMessageBox.Show(this, loans.msg, "Delete Loan", MessageBoxButtons.OK, MessageBoxIcon.Question);
                this.Close();
            }
        }
    public void DoUnlocks()
    {
        Transform unlocked = transform.Find("Unlocked").Find("Viewport").Find("Content");

        for (int i = unlocked.childCount; i > 0; i--)
        {
            Destroy(unlocked.GetChild(i));
        }
        Collectables.LoadCollectables();
        foreach (Hostage hostage in Collectables.UnlockedHostages)
        {
            GameObject gobj = Instantiate(unlockTemplate);
            gobj.transform.SetParent(unlocked);
            gobj.transform.Find("Image").GetComponent <Image>().sprite = hostage.getSprite();
            gobj.transform.Find("Name").GetComponent <Text>().text     = hostage.name;
            gobj.GetComponent <Button>().onClick.AddListener(() => DisplayHostage(hostage));
        }
    }
    public IEnumerator RespawnPlayerCoroutine()
    {
        player.transform.position = CheckPoint.transform.position;
        player.enabled            = false;
        player.GetComponent <Renderer> ().enabled      = false;
        player.GetComponent <BoxCollider2D> ().enabled = false;
        camera.isFollowing = false;
        Collectables.AddPoints(-penalty);
        yield return(new WaitForSeconds(2));

        Application.LoadLevel(GameOver);
        //Debug.Log ("Player Respawn");
        //yield return new WaitForSeconds (RespawnDelay);
        //player.transform.position = CheckPoint.transform.position;
        //player.enabled = true;
        //player.GetComponent<Renderer> ().enabled = true;
        //player.GetComponent<BoxCollider2D> ().enabled = true;
        //camera.isFollowing = true;
    }
        public void Update(GameTime gameTime)
        {
            Player.Update(gameTime);
            Collectables.ForEach(c => c.Update(gameTime));

            List <Collectable> collected = Collectables.FindAll(c => c.HasCollidedWithPlayer);

            foreach (var item in collected)
            {
                AllTheSpritesWithinTheScene.Remove(item);
                Collectables.Remove(item);
            }



            var spawnPointsWithinTheViewport   = AllSpawnPoints.FindAll(c => Helper.CurrentGame.GraphicsDevice.Viewport.Bounds.Contains(c.SpritePosition - new Vector2(Camera.CamPos.X, Camera.CamPos.Y)));
            var despawnPointsWithinTheViewport = AllDespawnPoints.FindAll(c => Helper.CurrentGame.GraphicsDevice.Viewport.Bounds.Contains(c.SpritePosition - new Vector2(Camera.CamPos.X, Camera.CamPos.Y)));

            if (spawnPointsWithinTheViewport.Count > 0 && despawnPointsWithinTheViewport.Count > 0)
            {
                if (!AllEnemies.Peek().IsVisible)
                {
                    AllEnemies.Peek().IsVisible         = true;
                    AllEnemies.Peek().SpritePosition    = spawnPointsWithinTheViewport.ElementAt(Helper.random.Next(spawnPointsWithinTheViewport.Count)).SpritePosition;
                    AllEnemies.Peek().TargetDestination = despawnPointsWithinTheViewport.ElementAt(Helper.random.Next(despawnPointsWithinTheViewport.Count)).SpritePosition;
                }
            }

            if (AllEnemies.Peek().IsVisible)
            {
                AllEnemies.Peek().Update(gameTime);
                if (AllEnemies.Peek().TargetReached)
                {
                    AllEnemies.Enqueue(AllEnemies.Dequeue());
                }
            }


            if (Collectables.Count <= 0)
            {
                Gameover = true;
            }
        }