public void OnThrow(TrueNews pNewsObj) { newsObj = pNewsObj; gameObject.SetActive(true); image.sprite = GetNewsSprite(); }
private bool CheckTrueNews() { var trueNewsHit = Physics2D.CircleCastAll(transform.position, sightRange, Vector2.zero, 0, game.Layers.Item); foreach (var item in trueNewsHit) { TrueNews trueNews = item.transform.GetComponent <TrueNews>(); if (trueNews) { //bubble.SetReaction(ECitizenReaction.What); targetPos = trueNews.GetPosition(); game.SoundManager.PlaySound(SoundManager.ESound.eCitizenNews); return(true); } } return(false); }
public bool UseItem(Player pPlayer, EMapItem pType) { switch (pType) { case EMapItem.None: break; case EMapItem.GSource: var hit = Physics2D.CircleCast(pPlayer.transform.position, Tower.MAX_UPG_DISTANCE, Vector2.zero, 0, game.Layers.Tower); if (hit) { hit.transform.gameObject.GetComponent <Tower>().StartUpgrade(pPlayer); } else { Debug.Log("No tower near"); game.SoundManager.PlaySound(SoundManager.ESound.eCannotUse); return(false); } return(true); case EMapItem.TrueNews: TrueNews trueNewsInstance = Instantiate(prefab_TrueNews); trueNewsInstance.transform.parent = transform; trueNewsInstance.Throw(pPlayer); pPlayer.Inventory.RemoveItem(pType); return(true); case EMapItem.TinFoilHat: if (pPlayer.TinFoilHat.IsActive) { Debug.Log("Tinfoil hat is already active"); game.SoundManager.PlaySound(SoundManager.ESound.eCannotUse); return(false); } pPlayer.TinFoilHat.Activate(); pPlayer.Inventory.RemoveItem(pType); return(true); } return(false); }