void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "PowerUp") { PlayerVariables.powerUp(); } }
private void GiveCorrespondingItemToTask(Task task) { if (task.name == "shelter1") { PlayerVariables.addToInventory("Lv1 Shelter"); PlayerVariables.addToInventory("Green Seed"); PlayerVariables.addToInventory("Green Seed"); PlayerVariables.addToInventory("Green Seed"); PlayerVariables.addToInventory("Green Seed"); } if (task.name == "testSoil1") { PlayerVariables.addToInventory("Dirt Checker"); } if (task.name == "shovelBot") { PlayerVariables.addToInventory("Shovel Bot"); } if (task.name == "shelter2") { PlayerVariables.addToInventory("Lv2 Greenhouse"); PlayerVariables.addToInventory("Brocc Seed"); PlayerVariables.addToInventory("Brocc Seed"); PlayerVariables.addToInventory("Brocc Seed"); PlayerVariables.addToInventory("Brocc Seed"); PlayerVariables.addToInventory("Green Seed"); importBot(); } }
public void AddPlayerVariable() { var ret = new GlobalVariableItemModel(PlayerVariables); PlayerVariables.Add(ret); PlayerVariables.SelectedItem = ret; }
void Start () { objectVar = GetComponent<ObjectVariables>(); growlingGoat = GetComponent<AIGrowlingGoat>(); playerVar = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerVariables>(); collider = GetComponent<Collider2D>(); }
void Start() { player = gameObject.transform.root.gameObject; dataHandler = player.GetComponent <DataHandler>(); if (dataHandler.playerData.rewardsPurchased.Contains(5)) { EnableAutoAim(); } anim2 = this.gameObject.GetComponent <Animator>(); // anim["Draw"].wrapMode = WrapMode.Once; // anim["Draw"].speed = 1f; audioSource = gameObject.GetComponent <AudioSource>(); itemHandler = gameObject.GetComponent <ItemHandler>(); maxBowPower = itemHandler.maxDrawPower; weaponDamage = itemHandler.effectInt; ammoCount = itemHandler.amount; LoadArrow(); weaponHudText = GameObject.Find("WeaponHUD").GetComponentInChildren <Text>(); weaponHudText.text = ammoCount.ToString(); inventory = gameObject.transform.root.GetComponentInChildren <Backpack>(true); inSlot = itemHandler.inSlot; playerVariables = player.GetComponent <PlayerVariables>(); mainCamera = Camera.main.gameObject; }
void Start () { player = GameObject.FindGameObjectWithTag("Player"); var_Player = player.GetComponent<PlayerVariables>(); sprite_dialog = obj_dialog.GetComponent<SpriteRenderer>(); aud = GetComponent<AudioSource>(); var = GetComponent<ObjectVariables>(); }
protected virtual void SerializeImpl(IO.BitStream s) { var condition_write_order = s.IsWriting ? mCompilerState.ConditionWriteOrder : null; var action_write_order = s.IsWriting ? mCompilerState.ActionWriteOrder : null; var trigger_write_order = s.IsWriting ? mCompilerState.TriggerWriteOrder : null; Collections.ActiveListUtil.Serialize(s, Conditions, Database.Limits.Conditions.CountBitLength, this, NewConditionFromBitStream, condition_write_order); Collections.ActiveListUtil.Serialize(s, Actions, Database.Limits.Actions.CountBitLength, this, NewActionFromBitStream, action_write_order); Collections.ActiveListUtil.Serialize(s, Triggers, Database.Limits.Triggers.CountBitLength, this, NewTriggerFromBitStream, trigger_write_order); s.StreamElements(GameStatistics, Database.Limits.GameStatistics.CountBitLength, this, _model => _model.NewGameStatistic()); GlobalVariables.Serialize(this, s); PlayerVariables.Serialize(this, s); ObjectVariables.Serialize(this, s); TeamVariables.Serialize(this, s); s.StreamElements(HudWidgets, Database.Limits.HudWidgets.CountBitLength); SerializeTriggerEntryPoints(s); ObjectTypeReferences.SerializeWords(s, Shell.EndianFormat.Little); s.StreamElements(ObjectFilters, Database.Limits.ObjectFilters.CountBitLength); if (Database.Limits.SupportsGameObjectFilters) { SerializeGameObjectFilters(s); } }
// Called when the node enters the scene tree for the first time. public override void _Ready() { this._playerVariables = GetNode <PlayerVariables>("/root/PlayerVariables"); this._scoreLabel = GetNode <Label>("ScoreLabel"); this._scoreLabel.Text = this._playerVariables.Score.ToString().PadLeft(this.ScoreLength, '0'); }
public bool runPowerUp(GameObject player) { _pVar = player.GetComponent <PlayerVariables>(); _pVar._baseMaxSpeed = _pVar._baseMaxSpeed * 1.5f; _pVar._normalSpeed = _pVar._normalSpeed * 2f; return(true); }
// Use this for initialization void Start () { var = GetComponent<ObjectVariables>(); audioManager = GameObject.FindGameObjectWithTag("GLOBAL_audio"); aud = audioManager.GetComponent<AudioSource>(); player = GameObject.FindGameObjectWithTag("Player"); var_player = player.GetComponent<PlayerVariables>(); }
private void Start() { voice = new SpVoice(); input = GetComponent <TMP_InputField>(); player = GameObject.Find("Player").GetComponent <PlayerVariables>(); pm = player.GetComponent <PlayerMovement>(); input.enabled = false; }
private void Start() { playerVariables = player.GetComponent <PlayerVariables>(); xpPopupText = xpPopup.GetComponent <TextMeshProUGUI>(); xpPopupRectTransform = xpPopup.GetComponent <RectTransform>(); xpPopupOriginalPos = xpPopupRectTransform.localPosition; audioSource = xpPopup.GetComponent <AudioSource>(); }
void Start () { playerVar = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerVariables>(); goat = transform.GetChild(0).gameObject.GetComponent<GoatAnimator>(); goatObject = transform.GetChild(1).gameObject.GetComponent<ObjectVariables>(); benchArray = GameObject.FindGameObjectsWithTag("OBJECT_bench"); timeUntilCanAttack = Random.Range(2, 5); }
// Update is called once per frame private void Update() { if (this.photonView.ownerId != assignedColorForUserId) { m_Renderer.material = PlayerVariables.GetMaterial(m_Renderer.material, this.photonView.ownerId); this.assignedColorForUserId = this.photonView.ownerId; //Debug.Log("Switched Material to: " + this.assignedColorForUserId + " " + this.renderer.material.GetInstanceID()); } }
public override void _Ready() { this._scoreLabel = GetNode <Label>("Score"); this._healthBar = GetNode <HealthBar>("HealthBar"); this._healthBar.SetValue(1); this._playerVariables = GetNode <PlayerVariables>("/root/PlayerVariables"); }
void Start() { _lockTransform = deathCanvas.transform.rotation; _pVar = GetComponent <PlayerVariables>(); _phy = GetComponent <CustomPhysics>(); _normalState = new NormalState(_pVar); _boostState = new BoostState(_pVar); _currentState = _normalState; _image = deathCanvas.GetComponentInChildren <Image>(); }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.GetComponent <isHoldable>() == true && robotMoveScript.isGrabbing == false) { PlayerVariables.sendMessage("System", "Item detected."); AudioSource.PlayClipAtPoint(collectSound, Vector3.zero); collision.gameObject.SetActive(false); PlayerVariables.addToInventory(collision.gameObject.GetComponent <itemIdentifier>().name); } }
private void Start() { _pVar = gameObject.GetComponent <PlayerVariables>(); _rb = gameObject.GetComponent <Rigidbody>(); _rb.position = transform.position; _rb.rotation = transform.rotation; _rb.centerOfMass = Vector3.zero; dead = false; StartCoroutine(GetComponent <RoombaVFX>().checkForRunVFX(_rb)); }
public void GetDirtSample() { if (PlayerVariables.findInInventory("Dirt Checker") != null) { StartCoroutine(CheckingDirt()); } else { PlayerVariables.sendMessage("System", "Inventory does not include a dirt checker!"); } }
IEnumerator CheckingDirt() { for (byte i = 0; i < 4; i++) { PlayerVariables.sendMessage("System", "Checking..."); yield return(new WaitForSeconds(Random.Range(.3f, 1.2f))); } PlayerVariables.sendMessage("System", "[COMPLETE] Contamination Level: " + PlayerVariables.atmosphereContamination + "%"); PlayerVariables.addTaskProgress("testSoil1", 1); isGrabbing = false; }
void SaveVariablesToGDS() { //Mostly stuff on the player GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player != null) { PlayerVariables pv = player.GetComponent <PlayerVariables>(); //gds.SDS.PlayerInfo.Current_Position = player.transform.position; //gds.SDS.PlayerInfo.Current_Rotation = player.transform.eulerAngles; } }
public override void InitiatePickup() { PlayerVariables.HeldKey = addedKey; string KeyText = PlayerVariables.GetKeyName(addedKey); if (attachedLight) { StartCoroutine(FadeLight()); } StartCoroutine(PlayerVariables.ShowText(KeyText + " key acquired!", 5f - 2 * PlayerVariables.UITextAnimation.length)); }
private void PopulatePanel() { //print("Debug Log: " + taskList[1].progress); Dictionary <string, int> itemizedInv = new Dictionary <string, int>(); foreach (string item in PlayerVariables.inventory) { if (Item.GetItemPrefab(item) != null) { if (!itemizedInv.ContainsKey(item)) { itemizedInv.Add(item, 1); } else { itemizedInv[item]++; } } } foreach (KeyValuePair <string, int> pair in itemizedInv) { string itemName = pair.Key; int itemAmount = pair.Value; string textLabel = itemName; if (itemAmount > 1) { textLabel += " (" + itemAmount + ")"; } GameObject itemUI = Instantiate(prefab, gameObject.GetComponent <Transform>()); itemUI.GetComponent <Transform>().Find("Text").GetComponent <Text>().text = textLabel; Button btn = itemUI.GetComponent <Button>(); btn.onClick.AddListener(() => { string removed = PlayerVariables.removeFromInventory(itemName); if (removed != null) { if (robotMoveScript.isGrabbing == false) { string newStr = itemName.Replace(" ", ""); GameObject pfClone = Instantiate(Resources.Load("Items/" + newStr) as GameObject); robotMoveScript.isGrabbing = true; robotMoveScript.chosenGameObject = pfClone; GameObject.Find("PickupRobot").GetComponent <canHoldItem>().pickUp(pfClone); gameObject.transform.parent.gameObject.SetActive(false); } else { PlayerVariables.sendMessage("Robot:", "Already have something in hand!"); } } }); } }
void Start () { //Dependancy "GridManager" gridManagerObject = GameObject.FindGameObjectWithTag("GridManager"); gridManager = gridManagerObject.GetComponent<GridManager>(); //Dependancy "GridVariables", "PlayerVariables" gridVar = GetComponent<GridVariables>(); playerVar = GetComponent<PlayerVariables>(); //Dependancy "GridLayer" gridLayer = GetComponent<GridLayer>(); //Set position of object based on current layer transform.position = new Vector3(transform.position.x, gridVar.gridLayer * gridManager.tileSize); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; timerText = timerObject.GetComponent <Text>(); } Instantiate(playerPrefab, checkpoint, Quaternion.identity); }
public override void Entry(IModHelper helper) { //string first=StardewModdingAPI.Program.StardewAssembly.Location; string first = StardewModdingAPI.Constants.ExecutionPath; contentPath = first.Remove(first.Length - 19, 19); StardewModdingAPI.Events.ControlEvents.KeyPressed += ShopCall; StardewModdingAPI.Events.ControlEvents.MouseChanged += ControlEvents_MouseChanged; StardewModdingAPI.Events.GameEvents.UpdateTick += gameMenuCall; // StardewModdingAPI.Events.GameEvents.UpdateTick += BedCleanUpCheck; StardewModdingAPI.Events.GameEvents.GameLoaded += GameEvents_GameLoaded; StardewModdingAPI.Events.GameEvents.OneSecondTick += MapWipe; StardewModdingAPI.Events.TimeEvents.DayOfMonthChanged += Util.ResetAllDailyBooleans; StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad; StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave; StardewModdingAPI.Events.SaveEvents.AfterSave += SaveEvents_AfterSave; StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterSave; StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick; StardewModdingAPI.Events.GraphicsEvents.OnPreRenderHudEvent += GraphicsEvents_OnPreRenderHudEvent; StardewModdingAPI.Events.GraphicsEvents.OnPostRenderHudEvent += draw; //StardewModdingAPI.Events.TimeEvents.DayOfMonthChanged += Util.WaterAllCropsInAllLocations; hasLoadedTerrainList = false; path = Helper.DirectoryPath; newLoc = new List <GameLoc>(); PlayerVariables.initializePlayerVariables(); Log.AsyncG("Revitalize: Running on API Version: " + StardewModdingAPI.Constants.ApiVersion); useMenuFocus = true; Lists.loadAllListsAtEntry(); if (File.Exists(Path.Combine(path, "xnb_node.cmd"))) { paintEnabled = true; Log.AsyncG("Revitalize: Paint Module Enabled"); } else { paintEnabled = false; Log.AsyncG("Revitalize: Paint Module Disabled"); } }
void Update() { PlayerVariables playerVariables = GetComponent <PlayerVariables>(); timeLeft -= Time.deltaTime; timeLeftUI.gameObject.GetComponent <Text>().text = ("" + (int)timeLeft); playerScoreUI.gameObject.GetComponent <Text>().text = ("" + playerScore); if (timeLeft < 0.1f) { playerVariables.Respawn(); timeLeft = 180; playerScore = 0; } }
// Start is called before the first frame update void Start() { playerScripts = GameObject.FindGameObjectWithTag("Player").GetComponents <MonoBehaviour>(); foreach (MonoBehaviour mono in playerScripts) { if (mono.GetType() == typeof(DashScript)) { if (canDash == false) { mono.enabled = false; } } else if (mono.GetType() == typeof(SlideScript)) { if (canSlide == false) { mono.enabled = false; } } else if (mono.GetType() == typeof(WallrunningScript)) { if (canWallrun == false) { mono.enabled = false; } } else if (mono.GetType() == typeof(WallclimbingScript)) { if (canClimb == false) { mono.enabled = false; } } else if (mono.GetType() == typeof(JumpScript)) { if (canJump == false) { mono.enabled = false; } } } UITextAnimator = UIText.GetComponent <Animator>(); textComp = UIText.GetComponent <TextMeshProUGUI>(); //StartCoroutine(TutorialText()); StartCoroutine(PlayerVariables.ShowText(InitialTut, hideTextAfter)); }
void Start () { //Dependency "PlayerVariables", "GridVariables" playerVar = GetComponent<PlayerVariables> (); gridVar = GetComponent<GridVariables>(); //Dependency "Player Sprite" playerAnimation = playerSprite.GetComponent<JensAnimationController>(); playerSize = playerSprite.GetComponent<SpriteSize>(); audioManager = GetComponent<AudioManager>(); aud = GetComponent<AudioSource>(); playerCollider = GetComponent<Collider2D>(); }
private bool currentTasksCompleted(List <string> taskSet) { foreach (string taskName in taskSet) { Task task = PlayerVariables.getTaskByName(taskName); if (task != null) { if (task.progress < task.steps) { return(false); } } } return(true); }
public void PlantWorldSeed() { if (itemSlot.GetChild(0).gameObject != null) { if (itemSlot.GetChild(0).gameObject.GetComponent <worldSeedPlantScript>()) { if (itemSlot.transform.GetChild(0).gameObject.GetComponent <itemIdentifier>().name == "Strong Purple Seed") { Vector3 savePos = itemSlot.transform.GetChild(0).position; Destroy(itemSlot.transform.GetChild(0).gameObject); robotMoveScript.chosenGameObject = null; robotMoveScript.isGrabbing = false; GameObject.Instantiate(Resources.Load("Plants/purple0") as GameObject, savePos + (0.3f * Vector3.down), Quaternion.Euler(0, 0, 0)); } if (itemSlot.transform.GetChild(0).gameObject.GetComponent <itemIdentifier>().name == "Red Seed") { Vector3 savePos = itemSlot.transform.GetChild(0).position; Destroy(itemSlot.transform.GetChild(0).gameObject); robotMoveScript.chosenGameObject = null; robotMoveScript.isGrabbing = false; if (Random.Range(0, 2) == 0) { GameObject.Instantiate(Resources.Load("Plants/tendril0") as GameObject, savePos + (0.3f * Vector3.down), Quaternion.Euler(0, 0, 0)); } else { GameObject.Instantiate(Resources.Load("Plants/snake0") as GameObject, savePos + (0.3f * Vector3.down), Quaternion.Euler(0, 0, 0)); } } if (itemSlot.transform.GetChild(0).gameObject.GetComponent <itemIdentifier>().name == "Grass Seed") { Vector3 savePos = itemSlot.transform.GetChild(0).position; Destroy(itemSlot.transform.GetChild(0).gameObject); robotMoveScript.chosenGameObject = null; robotMoveScript.isGrabbing = false; GameObject.Instantiate(Resources.Load("Plants/grass0") as GameObject, savePos + (0.3f * Vector3.down), Quaternion.Euler(0, 0, 0)); } } else { PlayerVariables.sendMessage("Robot:", "Not currently holding an outdoor plantable seed"); } } else { PlayerVariables.sendMessage("Robot:", "No seed in hand"); } }
// Update is called once per frame private void OnCollisionEnter2D(Collision2D collision) { if (robotMoveScript.isMovingToPosition == true) { if (robotMoveScript.isGrabbing == false) { robotMoveScript.chosenGameObject = gameObject; robotMoveScript.isSeekingPosition = false; } else { PlayerVariables.sendMessage("System", "Already grabbing something!"); robotMoveScript.isMovingToPosition = false; } } }
public override void InitiatePickup() { if (Wallclimb) { GameObject.FindGameObjectWithTag("Player").GetComponent <WallclimbingScript>().enabled = true; } else if (Slide) { GameObject.FindGameObjectWithTag("Player").GetComponent <SlideScript>().enabled = true; } else if (Dash) { GameObject.FindGameObjectWithTag("Player").GetComponent <DashScript>().enabled = true; } else if (Wallrun) { GameObject.FindGameObjectWithTag("Player").GetComponent <WallrunningScript>().enabled = true; } else if (Jump) { GameObject.FindGameObjectWithTag("Player").GetComponent <JumpScript>().enabled = true; } // Rotating the whole gameobject to face the player gameObject.transform.rotation = Quaternion.LookRotation(-GameObject.FindGameObjectWithTag("Player").transform.right); SimpleRotateFloatScript SRS = GetComponentInChildren <SimpleRotateFloatScript>(); if (SRS) { SRS.enabled = false; } PickupName.enabled = false; StartCoroutine(PlayerVariables.ShowText(Desc, destroyDelay - 2 * PlayerVariables.UITextAnimation.length));; if (attachedLight) { StartCoroutine(FadeLight()); } }
public static void DuringEntry() { Class1.hasLoadedTerrainList = false; Class1.path = Class1.modHelper.DirectoryPath; Class1.newLoc = new List <GameLoc>(); PlayerVariables.initializePlayerVariables(); //Log.AsyncG("Revitalize: Running on API Version: " + StardewModdingAPI.Constants.ApiVersion); Lists.loadAllListsAtEntry(); Settings.SettingsManager.Initialize(); Settings.SettingsManager.LoadAllSettings(); Settings.SettingsManager.SaveAllSettings(); }
// Start is called before the first frame update void Awake() { shipBody = gameObject.GetComponent <Rigidbody2D>(); playerVars = gameObject.GetComponent <PlayerVariables>(); if (photonView.IsMine) { //Player is local } else { //Player is Remote, deactivate the scripts and object that should only be enabled for the local player for (int i = 0; i < localScripts.Length; i++) { localScripts[i].enabled = false; } } }
// Use this for initialization void Start() { cachedY = healthTransform.position.y; minXvalue = 0; maxXvalue = healthTransform.localScale.x; currentHealth = (int)maxHealth; onCD = false; playerVar = GetComponent <PlayerVariables>(); source = GetComponent <AudioSource>(); cdTimerIsActive = false; doubleJumpCDText.text = "J"; burgerText.text = "X " + PlayerVariables.burgerCount; burgerEaten = false; // healthTransform // healthText // visualHealth = GameObject.Find("Health").GetComponent<Image>; }
// Use this for initialization void Start() { playerV = gameObject.GetComponent<PlayerVariables>(); health = MAXHEALTH; anim = GetComponent<Animator>(); }
void Start () { var = GetComponent<ObjectVariables>(); player = GameObject.FindGameObjectWithTag("Player"); var_player = player.GetComponent<PlayerVariables>(); }