// Use this for initialization void Start() { camera = Camera.main; playerStamina = GetComponent <PlayerStamina> (); currentCapacity = totalCapacity; warning = GameObject.FindGameObjectWithTag("warnings"); }
// Use this for initialization void Start() { playerStamina = GetComponent <PlayerStamina> (); camera = Camera.main; tool = Tools.NONE; hoe = GetComponent <Hoe> (); plant = GetComponent <PlantSeeds> (); wateringCan = GetComponent <WateringCan> (); sickle = GetComponent <Sickle> (); none = GetComponent <None> (); holdingItem = GetComponent <HoldingItem> (); inventory = GetComponent <InventoryManager> (); fountainCollision = GetComponent <FountainCollider> (); NPCCollision = GetComponentInChildren <NPCCollision> (); if (SceneManager.GetActiveScene().name.Contains("Outside") || SceneManager.GetActiveScene().name == "Farming" || SceneManager.GetActiveScene().name == "Farm") { outside = true; } else { outside = false; } anim = GetComponent <Animator> (); hoeGO = this.transform.Find("hoe").gameObject; wcanGO = this.transform.Find("wateringcan").gameObject; sickleGO = this.transform.Find("sickle").gameObject; buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress; }
public PlayerStamina Clone() { var result = new PlayerStamina(); CloneTo(this, result); return(result); }
public override void Interact(PlayerStamina playerStamina) { CreateTextbox.Create(Name, Text + "\nThis costs <color=blue>" + price + " gems</color>."); CreateTextbox.Create(Name, new string[] { "Buy", "Cancel" }, true, true, selection => { switch (selection) { // Buy case 0: if (playerStamina.Gems >= price) { if (playerStamina.HasItem) { CreateTextbox.Create(Name, "You're already holding an item..."); } else { playerStamina.AddGems(-price); playerStamina.Item = item; CreateTextbox.Create(Name, "Come again!"); } } else { CreateTextbox.Create(Name, "You don't have enough <color=blue>gems</color>..."); } break; // Cancel case 1: CreateTextbox.Create(Name, "Come again!"); break; } }); }
// Use this for initialization void Start() { Rooted = false; animator = GetComponent <Animator>(); playerStamina = GetComponent <PlayerStamina>(); }
public static void SetData(PlayerStamina data) { if (data == null || string.IsNullOrEmpty(data.Id)) { return; } DataMap[data.Id] = data; }
public static void CloneTo(PlayerStamina from, PlayerStamina to) { to.Id = from.Id; to.PlayerId = from.PlayerId; to.DataId = from.DataId; to.Amount = from.Amount; to.RecoveredTime = from.RecoveredTime; }
private void Awake() { playerHealth = GameObject.Find("Player").GetComponent <HealthScript>(); playerStamina = GameObject.Find("Player").GetComponent <PlayerStamina>(); if (PlayerInventory.Instance.CurrentItem != null) { itemText.text = PlayerInventory.Instance.CurrentItem.ItemUIText; } }
// Use this for initialization void Start() { pHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth> (); pMana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana> (); pStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> (); pSpawn = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerSpawn> (); meaningless = gameObject.GetComponentInChildren <Text> (); bLib = GameObject.FindGameObjectWithTag("Player").GetComponent <BonusesLibrary>(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerStamina = player.GetComponent<PlayerStamina>(); ground = GameObject.FindGameObjectWithTag("ground"); anim = GetComponent<Animator>(); CameraTurn = GetComponent<CameraTurn>(); ButtonTurn = GetComponent<ButtonTurn>(); }
// Use this for initialization void Awake () { m_Caracteristics = GetComponent<PlayerCaracteristics>(); m_Caracteristics.enabled = true; m_StaminaManager = GetComponent<PlayerStamina>(); m_StaminaManager.enabled = true; m_HealthManager = GetComponent<PlayerHealth>(); m_HealthManager.enabled = true; GetComponent<PlayerSpell>().enabled = true; }
private void Awake() { _barImage = transform.Find("bar").GetComponent <Image>(); if (_stamina == null) { _stamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina>(); } }
private void Construct(PlayerStamina playerStamina, SlowWalkController slowWalkController, SlowWalkRunController slowWalkRunController, PlayerMovement playerMovement) { _playerStamina = playerStamina; _slowWalkController = slowWalkController; _slowWalkRunController = slowWalkRunController; _playerMovement = playerMovement; }
private void Awake() { //Initialize components playerRigidBody = GetComponent<Rigidbody>(); parentRigidBody = GetComponentInParent<Rigidbody>(); anim = GetComponent<Animator>(); playerStamina = GetComponent<PlayerStamina>(); //Get the floor mask floorMask = LayerMask.GetMask("Ground"); }
// Use this for initialization void Start () { playerComboScript = gameObject.GetComponent<PlayerComboManager>(); playerStamina = gameObject.GetComponent<PlayerStamina>(); /**Initialise les sorts actif **/ if (SaveManager.instance.getValue<string>("Spell1") != default(string)) m_Spells[0] = (Spell)Activator.CreateInstance(Type.GetType(SaveManager.instance.getValue<string>("Spell1")), new object[] { gameObject }); if (SaveManager.instance.getValue<string>("Spell2") != default(string)) m_Spells[1] = (Spell)Activator.CreateInstance(Type.GetType(SaveManager.instance.getValue<string>("Spell2")), new object[] { gameObject }); if (SaveManager.instance.getValue<string>("Spell3") != default(string)) m_Spells[2] = (Spell)Activator.CreateInstance(Type.GetType(SaveManager.instance.getValue<string>("Spell3")), new object[] { gameObject }); }
void Start() { _movementComponent = GetComponent <PlayerMovement>(); Debug.Assert(_movementComponent != null); _staminaComponent = GetComponent <PlayerStamina>(); Debug.Assert(_staminaComponent != null); _animationComponent = GetComponent <PlayerAnimation>(); Debug.Assert(_animationComponent != null); _state = State.Idling; }
public void Awake() { //Initialize components player = GameObject.FindWithTag("Player"); rifleTip = GameObject.Find("RifleTip"); gunLine = rifleTip.GetComponent<LineRenderer>(); gunLight = rifleTip.GetComponent<Light>(); playerShooting = rifleTip.GetComponent<PlayerShooting>(); playerStamina = player.GetComponent<PlayerStamina>(); rend = GameObject.FindWithTag("RendPlayer").GetComponent<Renderer>(); }
// Use this for initialization void Start() { blockResetTimer = 0; canBlock = true; attacking = false; playerStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> (); pMana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana> (); pHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth> (); adl = gameObject.GetComponent <AttackDamageLibrary> (); itmBar = GameObject.FindGameObjectWithTag("ItemBarHolder").GetComponent <ItemBar>(); pressedR = 0; }
void Start() { controller = GetComponent <PlayerController>(); stamina = GetComponent <PlayerStamina>(); animate = GetComponent <Animator>(); audio = GetComponents <AudioSource> (); // finding child prefab attackObject = GameObject.Find("PlayerAttack"); attackObject.SetActive(false); }
public IPlayerStamina GetStamina(string playerId, string dataId) { IPlayerStamina stamina = null; if (!IPlayerStamina.DataMap.ContainsKey(IPlayerStamina.GetId(playerId, dataId))) { stamina = new IPlayerStamina(); stamina.Guid = IPlayerStamina.GetId(playerId, dataId); stamina.playerId = playerId; stamina.Guid = IPlayerStamina.GetId(playerId, dataId); stamina.dataId = dataId; IPlayerStamina.DataMap.Add(IPlayerStamina.GetId(playerId, dataId), stamina); return(stamina); //GameInstance.dbDataUtils.ExecuteNonQuery(@"INSERT INTO playerStamina (id, playerId, Guid, amount, recoveredTime) VALUES (@id, @playerId, @Guid, @amount, @recoveredTime)", // new SqliteParameter("@id", stamina.Id), // new SqliteParameter("@playerId", stamina.PlayerId), // new SqliteParameter("@Guid", stamina.DataId), // new SqliteParameter("@amount", stamina.Amount), // new SqliteParameter("@recoveredTime", stamina.RecoveredTime)); } else { return(IPlayerStamina.DataMap[PlayerStamina.GetId(playerId, dataId)]); } //var staminas = GameInstance.dbDataUtils.ExecuteReader(@"SELECT * FROM playerStamina WHERE playerId=@playerId AND Guid=@Guid LIMIT 1", // new SqliteParameter("@playerId", playerId), // new SqliteParameter("@Guid", dataId)); //if (!staminas.Read()) //{ // stamina = new PlayerStamina(); // stamina.Id = PlayerStamina.GetId(playerId, dataId); // stamina.PlayerId = playerId; // stamina.DataId = dataId; // GameInstance.dbDataUtils.ExecuteNonQuery(@"INSERT INTO playerStamina (id, playerId, Guid, amount, recoveredTime) VALUES (@id, @playerId, @Guid, @amount, @recoveredTime)", // new SqliteParameter("@id", stamina.Id), // new SqliteParameter("@playerId", stamina.PlayerId), // new SqliteParameter("@Guid", stamina.DataId), // new SqliteParameter("@amount", stamina.Amount), // new SqliteParameter("@recoveredTime", stamina.RecoveredTime)); //} //else //{ // stamina = new PlayerStamina(); // stamina.Id = staminas.GetString(0); // stamina.PlayerId = staminas.GetString(1); // stamina.DataId = staminas.GetString(2); // stamina.Amount = staminas.GetInt32(3); // stamina.RecoveredTime = staminas.GetInt64(4); //} //return stamina; }
//CharacterController cont; // Use this for initialization void Start() { playerStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> (); rb = gameObject.GetComponent <Rigidbody>(); speed = .2f; jumpTest = false; doCommunicate = false; stunned = false; //cont = gameObject.GetComponent<CharacterController>(); iBar = GameObject.FindGameObjectWithTag("ItemBarHolder").GetComponent <ItemBar>(); iScreen = GameObject.FindGameObjectWithTag("UI").GetComponent <InventoryScreen>(); pog = gameObject.GetComponentInChildren <PlayerOnGround>(); }
void Awake() { shootableMask = LayerMask.GetMask("Shootable"); //damage = PlayerPrefs.GetInt("Damage"); damage = 50; //gunParticles = GetComponent<ParticleSystem>(); gunLine = GetComponent<LineRenderer>(); gunLight = GetComponent<Light>(); playerStamina = GameObject.FindWithTag("Player").GetComponent<PlayerStamina>(); }
public void OnOpen(PlayerStamina player) { if (!open) { player.AddGems(gems); open = true; GetComponent <MeshFilter>().mesh = openMesh; Material material = GetComponent <MeshRenderer>().material; material.SetTexture("_MainTex", openTex); material.SetTexture("_BumpMap", openMap); CreateTextbox.Create("Chest", "You found <color=blue>" + gems.ToString() + " gems</color>!"); Opened(); } }
void Start() { destination = transform.position; controller = GetComponent <CharacterController>(); playerStamina = GetComponent <PlayerStamina>(); playerJump = GetComponent <PlayerJump>(); // Get a list of all the chest objects chests = new List <GameObject>(FindObjectsOfType <GameObject>()); chests.RemoveAll(gameObj => gameObj.CompareTag("Chest") == false); // Get a list of all NPC objects npcs = new List <GameObject>(FindObjectsOfType <GameObject>()); npcs.RemoveAll(gameObj => gameObj.CompareTag("NPC") == false); // Scale button offset; it was tuned for a height of 353px buttonOffset /= 353; buttonOffset *= Screen.height; // Calculate how many degrees we need to roll per second rollRotateSpeed = 360 / RollTime; }
// Use this for initialization void Start() { // get component for controller, sprite and stamina controller = GetComponent <Controller2D>(); greenPlayer = GetComponent <SpriteRenderer>(); playerTwoStamina = GetComponent <PlayerStamina>(); // adjust for gravity gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; // bullet facing left bulletRotation.eulerAngles = new Vector3(0, 0, 90); bulletRight = false; bulletLeft = true; // rotate sword swordRotation.eulerAngles = new Vector3(0, 0, 90); swordDirection = -1f; // don't flip player direction greenPlayer.flipX = false; }
// Use this for initialization void Start() { camera = Camera.main; playerActions = GetComponent <PlayerActions> (); playerStamina = GetComponent <PlayerStamina> (); playerAnimator = GetComponent <Animator> (); ///Resources/// tseeds = Resources.Load <Transform>("Crops/turnip/turnipseeds"); cabseeds = Resources.Load <Transform> ("Crops/cabbage/cabbageseeds"); cseeds = Resources.Load <Transform> ("Crops/carrot/carrotseeds"); onseeds = Resources.Load <Transform> ("Crops/onion/onionseeds"); radseeds = Resources.Load <Transform> ("Crops/radish/radishseeds"); spiseeds = Resources.Load <Transform> ("Crops/spinach/spinachseeds"); dairadseeds = Resources.Load <Transform> ("Crops/daikon radish/daikon radishseeds"); brocseeds = Resources.Load <Transform> ("Crops/broccoli/broccoliseeds"); chertreeseeds = Resources.Load <Transform>("Trees/cherryTree/cherryseeds"); petreeseeds = Resources.Load <Transform>("Trees/peachTree/peachseeds"); aptreeseeds = Resources.Load <Transform>("Trees/appleTree/appleseeds"); ortreeseeds = Resources.Load <Transform>("Trees/orangeTree/orangeseeds"); }
// Use this for initialization void Start() { timer = 0; if (PlayerPrefs.GetInt("points") != 0) { statPointsToSpend = PlayerPrefs.GetInt("points"); } else { statPointsToSpend = 0; } pHealth = gameObject.GetComponent <PlayerHealth> (); pStam = gameObject.GetComponent <PlayerStamina> (); pMana = gameObject.GetComponent <PlayerMana> (); bl = gameObject.GetComponent <BonusesLibrary> (); pMove = gameObject.GetComponent <PlayerMovement> (); enSpawn = GameObject.FindGameObjectWithTag("enemymanager").GetComponent <EnemySpawn> (); pHealth = gameObject.GetComponent <PlayerHealth> (); musicCont = gameObject.GetComponent <MusicController> (); inArena = true; //arenaIndex = 0; //currlevel = levelList [arenaIndex]; //musicCont.PlaySong (inArena); }
void Start() { playerStamina = player.GetComponent <PlayerStamina>(); playerMove = player.GetComponent <PlayerMove>(); actionText = actionTextObject.GetComponent <Text>(); }
// Use this for initialization void Awake () { playerComboScript = GetComponentInParent<PlayerComboManager>(); m_PlayerStamina = GetComponentInParent<PlayerStamina>(); m_Combo = new Combos(this, m_damageMultiplier, m_staminaCost); anim = GetComponent<Animator>(); }
// This is the function where the time is reseted each day //not only reseting time values but reseting the soil, //checking the state of our crops and reseting the player stamina public void resetDay() { crops = parent.GetComponentsInChildren <CropBehaviour> (); allTrees = FindObjectsOfType <TreeBehaviour> (); for (int i = 0; i < s.getSoil().Count; i++) { if (s.getSoil() [i].soilType == Soil.SoilTypes.PLOWED || s.getSoil() [i].soilType == Soil.SoilTypes.WATERED) { s.getSoil() [i].soilType = Soil.SoilTypes.NOTPLOWED; s.getSoil() [i].getSoil().GetComponent <Renderer> ().material = notPlowed; } if ((s.getSoil() [i].soilType == Soil.SoilTypes.WATEREDANDPLATED || s.getSoil()[i].soilType == Soil.SoilTypes.PLANTED)) { s.getSoil() [i].soilType = Soil.SoilTypes.PLANTED; s.getSoil() [i].getSoil().GetComponent <Renderer> ().material = plowed; } } for (int i = 0; i < crops.Length; i++) { if (!crops [i].watered && !crops[i].state.Equals(Crops.cropStates.HARVEST)) { if (crops [i].state.Equals(Crops.cropStates.SEED)) { crops [i].dayToS1 += 1; crops [i].dayToS2 += 1; crops [i].dayToHarvest += 1; } if (crops [i].state.Equals(Crops.cropStates.ST1)) { crops [i].dayToS2 += 1; crops [i].dayToHarvest += 1; } if (crops [i].state.Equals(Crops.cropStates.ST2)) { crops [i].dayToHarvest += 1; } crops [i].dry = true; } else { crops [i].dry = false; crops [i].growing(); } } stamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> (); if (stamina.fainted) { stamina.staminaSlider.value = 50; stamina.currentStamina = 50; } else { stamina.staminaSlider.value = 100; stamina.currentStamina = 100; } foreach (TreeBehaviour howManyDays in allTrees) { howManyDays.daysToNextStage -= 1; howManyDays.growingTree(); } MockNPCDB allNpc = FindObjectOfType(typeof(MockNPCDB)) as MockNPCDB; allNpc.Emily.gifted = false; allNpc.Emily.talked = false; allNpc.Riley.gifted = false; allNpc.Riley.talked = false; allNpc.Lily.gifted = false; allNpc.Lily.talked = false; allNpc.Tyler.gifted = false; allNpc.Tyler.talked = false; for (int i = 0; i < spawnFarmAreas.transform.childCount; i++) { for (int j = 0; j < spawnFarmAreas.transform.GetChild(i).childCount; j++) { Destroy(spawnFarmAreas.transform.GetChild(i).GetChild(j).gameObject); } spawnFarmAreas.transform.GetChild(i).GetComponent <SpawnItemsManager> ().spawnedItems = new List <GameObject> (); spawnFarmAreas.transform.GetChild(i).GetComponent <SpawnItemsManager> ().Spawn(); } for (int i = 0; i < spawnRoadAreas.transform.childCount; i++) { for (int j = 0; j < spawnRoadAreas.transform.GetChild(i).childCount; j++) { Destroy(spawnRoadAreas.transform.GetChild(i).GetChild(j).gameObject); } spawnRoadAreas.transform.GetChild(i).GetComponent <SpawnItemsManager> ().spawnedItems = new List <GameObject> (); spawnRoadAreas.transform.GetChild(i).GetComponent <SpawnItemsManager> ().Spawn(); } seconds = 0.0f; hour = 6.0f; day = day + 1; setWeather(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerStamina = player.GetComponent<PlayerStamina>(); ground = GameObject.FindGameObjectWithTag("ground"); }
public virtual void Interact(PlayerStamina playerStamina) { CreateTextbox.Create(Name, Text); }
// Use this for initialization void Start() { pStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina>(); }
private void Construct(PlayerStamina playerStamina, BloodGain bloodGain) { _bloodGain = bloodGain; _playerStamina = playerStamina; }
// Use this for initialization void Start() { camera = Camera.main; playerStamina = GetComponent <PlayerStamina> (); }
public void Awake() { //Initialize components player = GameObject.FindWithTag("Player"); playerStamina = player.GetComponent<PlayerStamina>(); }
private void Construct(PlayerStamina playerStamina) { _playerStamina = playerStamina; }
private void Start() { anim = gameObject.GetComponentInChildren <Animator>(); playerStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina>(); }
void Start() { rb = GetComponent <Rigidbody2D>(); PS = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina>(); }