private static void DrawPlayerPosition(PlayerNew player) { DrawUtil.DrawText("Player Position: " + pos.x + " , " + pos.y); GUILayout.BeginHorizontal(); xString = GUILayout.TextField(xString); yString = GUILayout.TextField(yString); GUILayout.EndHorizontal(); if (GUILayout.Button("Set Player Position")) { float x; float y; if (float.TryParse(xString, out x) && float.TryParse(yString, out y)) { Rigidbody2D rigidbody = player.GetComponent <Rigidbody2D>(); if (rigidbody != null) { rigidbody.position = new Vector2(x, y); } } } DrawUtil.DrawText("Player Velocity: " + vel.x + " , " + vel.y); }
public static void DrawAllColliders() { GameManager gm = GameManager.instance; if (gm == null) { return; } PlayerNew player = gm.Player; if (player == null) { return; } Vector3 pos = player.circleCollider.bounds.center; var colls = Physics2D.OverlapCircleAll(pos, Main.settings.DrawRadius, Main.settings.GetMask()); foreach (var collider in colls) { if (collider.isTrigger) { if (Main.settings.DrawTriggers) { DrawCollider(collider, Color.yellow); } } else { DrawCollider(collider, Color.white); } } }
// Use this for initialization void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } }
void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } vendorItems = new List <Item>(); int randomNumberOfItems = Random.Range(2, 7 + 1); for (int i = 0; i < randomNumberOfItems; i++) { vendorItems.Add(ItemGenerator.CreateItem("weapon", "random", player.Level)); } randomNumberOfItems = Random.Range(2, 6 + 1); for (int i = 0; i < randomNumberOfItems; i++) { vendorItems.Add(ItemGenerator.CreateItem("armor", "random", player.Level)); } randomNumberOfItems = Random.Range(0, 2 + 1); for (int i = 0; i < randomNumberOfItems; i++) { vendorItems.Add(ItemGenerator.CreateItem("socket", "random", player.Level)); } }
public override bool CheckConditions(PlayerNew player) { if (player.Level >= 5) { return(true); } return(false); }
public override bool CheckConditions(PlayerNew player) { if (player.questsComplete.Count >= 5) { return(true); } return(false); }
public override bool CheckConditions(PlayerNew player) { if (player.BossesKilled.Count >= 1) { return(true); } return(false); }
public override bool CheckConditions(PlayerNew player) { if (player.MonstersKilled >= 20) { return(true); } return(false); }
public override bool CheckConditions(PlayerNew player) { if (player.Gold >= 10000) { return(true); } return(false); }
void Start() { GUIHandler = GameObject.FindGameObjectWithTag("GUIHandler").GetComponent <MyGUI>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); player.playerState = PlayerState.Normal; _stashWindowRect = new Rect(Screen.width / 2 - 150, Screen.height / 2 - 125, 250, 290); selStrings = new string[] { "Tab 1", "Tab 2", "Tab 3", "Tab 4", "Tab 5" }; }
private void Update() { //Find the player in the scene if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } }
// Use this for initialization public void Start() { playerGO = GameObject.FindGameObjectWithTag("Player"); if (playerGO != null) { player = playerGO.GetComponent <PlayerNew>(); } }
void Start() { GUIHandler = GameObject.FindGameObjectWithTag("GUIHandler").GetComponent <MyGUI>(); _pc = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); _characterWindowRect = new Rect(5, 120, 300, 300); _characterPanelNames = new string[] { "Equipment", "Attributes", "Skills" }; inventoryWindowGUI = GameObject.FindGameObjectWithTag("GUIHandler").GetComponent <InventoryWindowGUI>(); }
private void Start() { movingWall = GameObject.FindGameObjectWithTag("CrushingWall"); player = GetComponent <PlayerNew>(); rigi = GetComponent <Rigidbody2D>(); sr = GetComponent <SpriteRenderer>(); c2d = GetComponent <Collider2D>(); anim = GetComponent <Animator>(); player.stamina = player.MaxStamina; }
private void Update() //# { //Find the player in the scene if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } //Assign the door ID to key ID and match the color keyID = doorScript.DoorID; GetComponent <SpriteRenderer>().color = door.GetComponent <SpriteRenderer>().color; }
// Use this for initialization void Start() { playerNew = GetComponent <PlayerNew>(); if (globalPrefabs == null) { globalPrefabs = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GlobalPrefabs>(); } startRespawn = true; //Will start respawn if needed }
void Start() { GUIHandler = GameObject.FindGameObjectWithTag("GUIHandler").GetComponent <MyGUI>(); _pc = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); achievementsHandler = GameObject.FindGameObjectWithTag("AchievementHandler").GetComponent <AchievementHandler>(); _questWindowRect = new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400); questWindowPanels = new string[] { "Quests", "Achievements" }; questTrackerShowActive = true; questTrackerShowComplete = true; playerQuests = new List <NPCQuest>(); ShowMiniQuestTracker = true; }
void Start() { if (_pc == null) { _pc = GetComponent <PlayerNew>(); } if (globalPrefabs == null) { globalPrefabs = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GlobalPrefabs>(); } }
// Update is called once per frame void OnMouseDown() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); if (Vector3.Distance(transform.position, player.transform.position) < 3.0f) { Messenger.Broadcast("ShowStashWindow"); StashWindowGUI.openedStash = this; } else { Debug.Log("Too far"); } }
// Use this for initialization void Start() { if (target == null) { target = GameObject.FindGameObjectWithTag("Player"); } player = target.GetComponent <PlayerNew>(); _pickedUpIconRect = new Rect(0, 0, 40, 40); inventoryWindowGUI = GameObject.FindGameObjectWithTag("GUIHandler").GetComponent <InventoryWindowGUI>(); }
void Start() { FindHarvestItem(); if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } if (playerCamera == null) { playerCamera = GameObject.FindGameObjectWithTag("MainCamera"); } }
void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } if (globalPrefabs == null) { globalPrefabs = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GlobalPrefabs>(); } OriginalAttacksPerSecond = AttacksPerSecond; }
// Use this for initialization void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } //If we have no achievement data if (Achievements.Count < 1) { TotalAchievementScore = 0; AddAllAchievements(); } }
public static void Prefix(PlayerNew __instance, int ___floorRays, CircleCollider2D ___circleCollider, float ___circleColliderWidth, float ___circleColliderHeight, LayerMask ___floorLayerMask, float ___maxSlopeAngle) { //Clear list here since this is only called on FixedUpdate lineList.Clear(); for (int i = 0; i < ___floorRays; i++) { RaycastHit2D highestHit = default(RaycastHit2D); float x = ___circleCollider.bounds.min.x + ___circleColliderWidth / (float)(___floorRays - 1) * (float)i; Vector2 vector = new Vector2(x, __instance.transform.position.y); Vector2 vector2 = new Vector2(x, __instance.transform.position.y - ___circleColliderHeight); RaycastHit2D[] array = Physics2D.LinecastAll(vector, vector2, ___floorLayerMask); foreach (RaycastHit2D raycastHit in array) { raycastHit.collider.GetComponent <BouncyBlock>(); if (raycastHit.collider && !raycastHit.collider.isTrigger) { float floorAngle = Vector2.Angle(Vector2.up, raycastHit.normal); raycastHit.collider.GetComponent <Rigidbody2D>(); FloatUpwards component = raycastHit.collider.GetComponent <FloatUpwards>(); if (floorAngle < ___maxSlopeAngle && raycastHit.point.y < __instance.transform.position.y && !component) { if (!highestHit.collider) { highestHit = raycastHit; //this.standingMaterial = raycastHit2D2.collider.sharedMaterial; } if (raycastHit.point.y > highestHit.point.y) { highestHit = raycastHit; //this.standingMaterial = raycastHit2D2.collider.sharedMaterial; } } } } if (highestHit.collider) { lineList.Add(new DrawUtil.Line(vector, vector2, Color.green)); } else { lineList.Add(new DrawUtil.Line(vector, vector2, Color.red)); } } }
void Start() { GUIHandler = GameObject.FindGameObjectWithTag("GUIHandler").GetComponent <MyGUI>(); _pc = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); _maxInventorySpace = _pc.MaxInventorySpace; _inventoryRows = _maxInventorySpace / _inventoryCols; _inventoryWindowRect = new Rect((Screen.width - 5) - (itemWidth * _inventoryCols) - _offset, 50, (itemWidth * _inventoryCols) + _offset, (itemHeight * _inventoryRows) + _offset + 15 + 25); _maxInventorySpace = _inventoryRows * _inventoryCols; buttonRects = new Rect[_maxInventorySpace]; }
// Use this for initialization void Start () { pc = GameObject.FindGameObjectWithTag ("Player"); if(pc ==null){ pc = GameObject.FindGameObjectWithTag ("Player"); } if(playerNew == null){ playerNew = pc.GetComponent<PlayerNew>(); } if(achievementHandler == null){ achievementHandler = GameObject.FindGameObjectWithTag ("AchievementHandler").GetComponent<AchievementHandler>(); } }
// Use this for initialization void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } npcTextOrig = npcText; textNum = 0; if (HighlightLight != null) { HighlightLight.enabled = false; } if (npcNameLevel != null) { npcNameLevel.text = NpcName; } vendor = GetComponent <NPCVendor>(); if (vendor != null) { isVendor = true; } else { isVendor = false; } blacksmith = GetComponent <NPCBlacksmith>(); if (blacksmith != null) { isBlacksmith = true; } else { isBlacksmith = false; } if (string.IsNullOrEmpty(buttonText[0])) { buttonText[0] = "Next"; } if (string.IsNullOrEmpty(buttonText[1])) { buttonText[0] = "Close"; } }
public void LoadFinishedQuest() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } foreach (NPCQuest nq in player.questsComplete) { if (nq.QuestID == this.QuestID) { return; } } player.questsComplete.Add(this); }
// Use this for initialization void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNew>(); } trackSteps = true; for (int i = 0; i < RewardNum; i++) { Item x = ItemGenerator.CreateItem(rewardType, "legendary", player.Level); QuestReward.Add(x); } QuestNPCName = GetComponent <NPCDialog>().NpcName; CheckRequirements(); }
// Use this for initialization void Start() { //Clone player and get the PlayerNew script and record the spawnPoint player = Instantiate(playerPrefab, new Vector3(startPosition.position.x, startPosition.position.y, -1), Quaternion.identity); playerData = player.GetComponent <PlayerNew>(); playerData.setSavePointPos(startPosition.position); allDoors = GameObject.FindGameObjectsWithTag("Door"); allKeys = GameObject.FindGameObjectsWithTag("Key"); keyToBeSaved = new List <GameObject>(); keySaved = new List <GameObject>(); doorToBeSaved = new List <GameObject>(); doorSaved = new List <GameObject>(); sprint.maxValue = playerData.MaxStamina; battery.maxValue = playerData.Battery; }