public PickUp(Vector3 p, PickUpType t, PickUpGen pug) { pos = p; type = t; collisionCells = new List<CollisionGridCell>(); pickupGen = pug; }
public void ActivateEffect(PickUpType type, float duration) { timer = 0; pickupTimer = duration; if (type == PickUpType.Immunity) { StartCoroutine("SetImmunity"); } else if (type == PickUpType.SpeedUp) { tempSpeed = 10.0f; StartCoroutine("SetSpeed"); } else if (type == PickUpType.SlowDown) { StartCoroutine("StopBoost"); } else if (type == PickUpType.DontEat) { StartCoroutine("NoEating"); } else if (type == PickUpType.LoseMass) { LoseMass(this.currentMass * 0.05f); } }
public PickUp(Vector3 p, PickUpType t, PickUpGen pug) { pos = p; type = t; collisionCells = new List <CollisionGridCell>(); pickupGen = pug; }
/** * <summary>Collects a game object on player interaction and updates * the player's data appropriately.</summary> * * <param name="player">The player game object.</param> * <param name="pickUp">The pick up game object.</param> */ private void OnPlayerWithPickUp(GameObject player, GameObject pickUp) { PlayerData playerData = GetPlayerData(player); PickUpType pickUpType = pickUp.GetComponent <PickUp>().GetPickUpType(); switch (pickUpType) { case PickUpType.Treasure: playerData.Score += 100; app.controller.ui.UpdatePlayerScore(playerData.PlayerNum); break; case PickUpType.Food: playerData.Health += 100; app.controller.ui.UpdatePlayerHealth(playerData.PlayerNum); break; case PickUpType.Potion: playerData.Potions++; break; case PickUpType.Key: playerData.CollectedKeys++; break; default: break; } Destroy(pickUp); }
// Constructor public PickUp(Vector2 position, bool hasEndTime, int effectTime, PickUpType pickUpPowerUp) : base(position) { this.pickUpPowerUp = pickUpPowerUp; LoadContent(GameWorld.myContent); this.layer = 0.5f; SetupPickUp(this); }
public bool PickUpDestroy(PickUpType pickUpType) { if (pickUpType == PickUpType.SpawnPoint) { return(false); } return(true); }
public StashAct(CreatureAI agent, PickUpType type, Zone zone, string targetName, string stashedItemOut) : base(agent) { Name = "Stash " + targetName; PickType = type; Zone = zone; TargetName = targetName; StashedItemOut = stashedItemOut; }
public void SpawnPickUp() { PickUpType type = PickUps[spawner.waveId].PickUpType; Vector2 spawnPos = PickUps[spawner.waveId].SpawnPos; GameObject pickUp = PoolManager.Instance.SpawnPools["Misc"].Spawn("PickUp", spawnPos); pickUp.transform.position = spawnPos; pickUp.GetComponent <SpriteRenderer>().sprite = pickUpsprites.Find(x => x.name == type.ToString()); pickUp.GetComponent <PickUp>().Type = type; }
public static string GetName(this PickUpType pickUpType) { switch (pickUpType) { case PickUpType.Key: return("Key"); default: return(pickUpType.ToString()); } }
public PickUpAnim getPickUpAnimation(PickUpType pickUpType) { switch (pickUpType) { case PickUpType.FromChest: return(Animation); case PickUpType.FromDrop: return(AnimationForDrops); } return(PickUpAnim.None); }
public void PickUp(PickUpType pickup) { switch (pickup) { case PickUpType.Key: gameManager.AddInventory("Key"); break; default: break; } }
void OnCollisionEnter2D(Collision2D collision) //Player Touches Anything { GameObject hit = collision.gameObject; if (hit.tag == "PickUps") //Plyaer touches a PickUp { PickUpBehavior hitScript = hit.GetComponent <PickUpBehavior>(); PickUpType hitType = hitScript.getPickUpType(); boardScript.addCounter(hitType); //add to counter on BoardManager Script; Destroy(hit); } }
// public void PickedUp () // { // AddItem(itemPickedUp); // } // public void OnTriggerEnter(Collider other) // { // if(other.gameObject.GetComponent<Item>()) /* if(other.tag == "Item") * { * print("Colliding"); * itemPickedUp = other.gameObject; * AddItem(itemPickedUp); * } * */ // } //itemPickedUp = other.gameObject; public void AddItem(PickUpType item) { // AddItem(itemPickedUp); for (int i = 0; i < slots; i++) { if (slot[i].GetComponent <Slot>().empty) { slot[i].GetComponent <Slot>().item = itemPickedUp; slot[i].GetComponent <Slot>().itemIcon = itemPickedUp.GetComponent <Item>().icon; } } }
public PickUp spawnPickUp(int X, int Y, PickUpType type) { if (!PickUpMapping.ContainsKey(type)) { throw new IndexOutOfRangeException("Sorry this Pickup was not selected on startup!"); } if (AvailablePickupTypes.Count == 0) { return(null); } var pickupInfo = PickUpMapping[type]; return((PickUp)pickupInfo.Invoke(new object[] { X, Y, TheGame })); }
void Awake() { DontDestroyOnLoad(gameObject); playerLifes = 3; isPlayerHit = false; pickType = PickUpType.None; float percent = (float)GameManager.Instance.PlayerData.Upgrades.Find(x => x.Title == "Shield Upgrade").Rank / 10; currentShieldCharge = GameManager.Instance.PlayerData.PlayerShieldCharge + (GameManager.Instance.PlayerData.PlayerShieldCharge * percent); maxShieldCharge = currentShieldCharge; playerCoinCount = GameManager.Instance.PlayerData.Coincount; }
public void addCounter(PickUpType type) //Add to specific type counter, invoked by playerBehavior { switch (type) { case PickUpType.attack: attackCounter += 1; break; case PickUpType.defend: defendCounter += 1; break; case PickUpType.heal: healCounter += 1; break; } }
public void PickUp(PickUpType pickUpType, GameObject thingIHit) { if (pickUpType == PickUpType.SpawnPoint) { spawnPos = collider.transform.position + Vector3.up * 4; return; } Debug.Log(thingIHit.name); //considering that there's anything else but spawnpoints. switch (pickUpType) { case PickUpType.BuildPoint: BuildController.ModifyBuildPoints(thingIHit.GetComponent <Pickup>().buildPointsToEarn, player); break; } PickUpDestroy(pickUpType); }
private Sprite SetSprite(PickUpType p) { string s = p.ReturnString(); switch (s) { case "Key": return(key); case "Health": return(health); case "None": return(none); default: return(none); } }
public void AddToInventory(PickUpType p) { Debug.Log(pickUps.Length); for (int i = 0; i < pickUps.Length; ++i) { GameObject button; if (pickUps[i].ReturnString() == "None") { if (p.ReturnString() == "Key") { AudioSource.PlayClipAtPoint(keyClip, transform.position); } pickUps[i] = p; button = InvPanel.transform.GetChild(i).gameObject; button.GetComponent <Image>().sprite = SetSprite(p); break; } } }
/// <summary> /// This is the default constuctor. /// </summary> /// <param name="TripID"></param> /// <param name="ArrivalTime"></param> /// <param name="DepartureTime"></param> /// <param name="StopID"></param> /// <param name="StopSequence"></param> /// <param name="StopHeadSign"></param> /// <param name="PickUpType"></param> /// <param name="DropOffType"></param> /// <param name="ShapeDistTraveled"></param> public StopTime( string TripID, TimeSpan ArrivalTime, TimeSpan DepartureTime, string StopID, int StopSequence, string StopHeadSign, PickUpType PickUpType, DropOffType DropOffType, string ShapeDistTraveled ) { mTripID = TripID; mArrivalTime = ArrivalTime; mDepartureTime = DepartureTime; mStopID = StopID; mStopSequence = StopSequence; mStopHeadSign = StopHeadSign; mPickUpType = PickUpType; mDropOffType = DropOffType; mShapeDistTraveled = ShapeDistTraveled; }
PickUpData GetData() { if (typesProbability.Count == 0) { for (int i = 0; i < datas.Count; i++) { for (int j = 0; j < datas[i].rarity; j++) { typesProbability.Add(datas[i].type); } } } int id = Random.Range(0, typesProbability.Count); PickUpType type = typesProbability[id]; typesProbability.Remove(type); PickUpData data = dicDatas[type]; return(data); }
public void PickUp(PickUpType pickUpType, GameObject thingIHit, Pickup pickup) { Debug.Log("pickuptpye" + pickUpType); if (pickUpType == PickUpType.SpawnPoint) { spawnPos = thingIHit.transform.position + Vector3.up * 4; if (pickup.isFinish && checkPoint == 9) { if (round < BuildController.inst.roundsToDrive) { round++; roundsText.text = "Rounds: " + round + " / " + (BuildController.inst.roundsToDrive + 1); } else { SceneManager.LoadScene("CarBuilder", LoadSceneMode.Single); round = 0; checkPoint = 0; } checkPoint = -1; } if (pickup.checkpoint == checkPoint + 1) { checkPoint = pickup.checkpoint; } } //considering that there's anything else but spawnpoints. if (pickUpType == PickUpType.BuildPoint) { BuildController.ModifyBuildPoints(pickup.buildPointsToEarn, player); } PickUpDestroy(pickUpType); }
public void ShowItemPickedUp(ItemType itemType, PickUpType pickUpType) { if (PickupItemParent == null) { return; } ItemData itemData = Database.Item.FindItem(itemType); if (itemData == null) { return; } SetFrozen(true, true, true); pickUpObject = itemType; pickupTypeObject = pickUpType; pickedUpItem = (GameObject)Instantiate(itemData.prefab); pickedUpItem.transform.parent = PickupItemParent; pickedUpItem.transform.localPosition = Vector2.zero; pickedUpItem.transform.localRotation = Quaternion.identity; }
private void CreateRandomPickUp() { m_RandomNumber = Random.Range(0, 3); switch (m_RandomNumber) { case 0: m_PickUpType = PickUpType.SpedUp; break; case 1: m_PickUpType = PickUpType.DoubleJump; break; case 2: m_PickUpType = PickUpType.StrongerPush; break; default: break; } EnableVisuals(); }
public void setPickUpType(PickUpType type) { upType = type; switch (upType) { case PickUpType.Character: NitroPickUp.SetActive(false); TirePickUp.SetActive(false); CharPickUp.SetActive(true); break; case PickUpType.Nitro: NitroPickUp.SetActive(true); TirePickUp.SetActive(false); CharPickUp.SetActive(false); break; case PickUpType.Tires: NitroPickUp.SetActive(false); TirePickUp.SetActive(true); CharPickUp.SetActive(false); break; } }
private void Start() { put = GetComponent <PickUpType>(); }
public static void addEnemy(Vector2 location, PickUpType pickUpType) { m_PickUpManagers[(int)pickUpType].addEnemy(location); }
/// <summary> /// This is the default constuctor. /// </summary> /// <param name="TripID"></param> /// <param name="ArrivalTime"></param> /// <param name="DepartureTime"></param> /// <param name="StopID"></param> /// <param name="StopSequence"></param> /// <param name="StopHeadSign"></param> /// <param name="PickUpType"></param> /// <param name="DropOffType"></param> /// <param name="ShapeDistTraveled"></param> public StopTime( string TripID, TimeSpan ArrivalTime, TimeSpan DepartureTime, string StopID, int StopSequence, string StopHeadSign, PickUpType PickUpType, DropOffType DropOffType, string ShapeDistTraveled ) { mTripID=TripID ; mArrivalTime=ArrivalTime ; mDepartureTime=DepartureTime ; mStopID=StopID ; mStopSequence=StopSequence ; mStopHeadSign=StopHeadSign ; mPickUpType=PickUpType ; mDropOffType=DropOffType ; mShapeDistTraveled=ShapeDistTraveled ; }
public void setPickUpType(PickUpType type) { pickUpType = type; }
public void HandlePickUp(GameObject pickUp) { if (pickUp is PickUp) { PickUp tempPick = pickUp as PickUp; #region PickUp's if ((pickUp as PickUp).PickUpPowerUp == PickUpType.BigPlayer) { hasPowerUp = true; PlayAnimation("BigPlayer"); currentPickUp = PickUpType.BigPlayer; powerUpEnd = DateTime.Now.AddSeconds(tempPick.EffectTime); } if ((pickUp as PickUp).PickUpPowerUp == PickUpType.ColorChange) { this.Color = new Color( (byte)RandomPicker.Rnd.Next(0, 255), (byte)RandomPicker.Rnd.Next(0, 255), (byte)RandomPicker.Rnd.Next(0, 255)); } if ((pickUp as PickUp).PickUpPowerUp == PickUpType.FastPlayer) { hasPowerUp = true; this.Speed += 300.0f; currentPickUp = PickUpType.FastPlayer; powerUpEnd = DateTime.Now.AddSeconds(tempPick.EffectTime); } if ((pickUp as PickUp).PickUpPowerUp == PickUpType.InverseControl) { hasPowerUp = true; inverseControl = true; currentPickUp = PickUpType.InverseControl; powerUpEnd = DateTime.Now.AddSeconds(tempPick.EffectTime); } if ((pickUp as PickUp).PickUpPowerUp == PickUpType.SlowPlayer) { hasPowerUp = true; this.Speed -= 250.0f; currentPickUp = PickUpType.SlowPlayer; powerUpEnd = DateTime.Now.AddSeconds(tempPick.EffectTime); } if ((pickUp as PickUp).PickUpPowerUp == PickUpType.SmallPlayer) { hasPowerUp = true; PlayAnimation("SmallPlayer"); currentPickUp = PickUpType.SmallPlayer; powerUpEnd = DateTime.Now.AddSeconds(tempPick.EffectTime); } if ((pickUp as PickUp).PickUpPowerUp == PickUpType.xScore) { if (this.isFirstPlayer) GameWorld.Player1Score += 2; else if (!this.isFirstPlayer) GameWorld.Player2Score += 2; } #endregion } }
public Pickup(Texture2D tex, Vector2 position, Vector2 velocity, PickUpType type) : base(tex, position, velocity) { this.type = type; loadAnimations(); }
public void AddItem(ItemType itemType, PickUpType pickupType) { AddItem(itemType, 1, pickupType); }
private void Awake() { spawner = GameObject.Find("Spawner").GetComponent <Spawner>(); GetPickUpSprites(); currentPickUp = PickUpType.None; }
public void AddItem(ItemType itemType, int amount, PickUpType pickupType) { if (items.ContainsKey(itemType) == true) { items[itemType] += amount; } else { items.Add(itemType, amount); } // Debug.Log("Adding + " + itemType + " " + amount); if (amount > 0) { ItemData itemData = Database.Item.FindItem(itemType); if (itemData != null) { if (itemData.getPickUpAnimation(pickupType) != ItemData.PickUpAnim.None) { movementModel.ShowItemPickedUp(itemType, pickupType); } if (itemData.isEquipable == ItemData.EquipPosition.SwordHand) { movementModel.EquipWeapon(itemType); source.clip = getTheSword; source.Play(); } if (itemData.isEquipable == ItemData.EquipPosition.ShieldHand) { movementModel.EquipShield(itemType); } if (itemData.type == ItemType.Bomb) { source.clip = getTheBomb; source.Play(); } if (itemData.type == ItemType.Rupee) { source.clip = getTheRupee; source.Play(); } } if (itemData.type == ItemType.Heart) { PlayHeartSound(); // if (characterHealth.GetHealth() > 80) if (GameObject.Find("Character").GetComponent <CharacterHealth>().GetHealth() > 80) { GameObject.Find("Character").GetComponent <CharacterHealth>().health = 100; } else { GameObject.Find("Character").GetComponent <CharacterHealth>().AddHealth(20); } } } }