// Use this for initialization void Start() { TrackManager track = (TrackManager)FindObjectOfType (typeof(TrackManager)); stats = track.GetStats(); speed = stats.baseSpeed; thrusterSize = leftThruster.startSize; }
// Use this for initialization void Start() { ps = gameObject.GetComponent<PlayerStats> (); sc = gameObject.GetComponent<StateController> (); tpb = gameObject.GetComponent<TestPlayerBehaviour> (); buffSetup (); }
// Use this for initialization void Start() { stats = player.GetComponent<PlayerStats> (); lastPos = GetComponent<Transform>().position; playerInputManager = GameObject.FindGameObjectWithTag("Player").GetComponent<InputHandler>(); }
public void Init(Unit playerUnit, PlayerStats initStats) { PlayerUnit = playerUnit; UpdateVariables(initStats); CurrentDiamondsCount = new PlayerDiamonds(0, 0, 0); }
void Awake() { playerStats = GetComponent<PlayerStats>(); References.stateManager.changeState += onChangeState; animations = GetComponentInChildren<Animations>(); enemies = new System.Collections.Generic.List<GameObject>(); }
/// <summary> /// Method triggered whenever someone dies /// </summary> /// <param name="victim">Player that got killed</param> /// <param name="killer">Player who killed the fella</param> public void CountDeaths(PlayerStats victim, PlayerStats killer) { switch (victim.team) { case (1): teamOneDeathCount++; if (killer) teamTwoKillCount++; teamOneScore -= GetDeathsScore(victim); break; case (2): teamTwoDeathCount++; if (killer) teamOneKillCount++; teamTwoScore -= GetDeathsScore(victim); break; default: break; } victim.score -= GetDeathsScore(victim); if (killer) { float score = GetKillScore(victim); killer.score += score; if (killer.team == 1) teamOneScore += score; else if (killer.team == 2) teamTwoScore += score; } foreach (GameObject go in GameObject.FindGameObjectsWithTag("Player")) go.GetComponent<EventManager>().SendScoreEvent(teamOneScore, teamTwoScore); }
void Start() { defaulyPlayerStats = new PlayerStats(); toxicDmgTimerRes = toxicDmgTimer; normalMoveSpeed = defaulyPlayerStats.moveSpeed; toxicMoveSpeed = defaulyPlayerStats.moveSpeed / moveSpeedDecrease; }
void Start() { player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerStats>();//.GetComponent<PlayerStats>(); h_text = GetComponent<Text> (); //h_script = player.GetComponent<PlayerStats> (); }
/// <summary> /// Initialization method. Creates all the upgrade options. /// </summary> void Start() { levelUpgradeOptions = new PlayerStats[,] { { PlayerStats.MovSpd, PlayerStats.Atk }, { PlayerStats.MovSpd, PlayerStats.Atk }, { PlayerStats.Def, PlayerStats.Atk }, { PlayerStats.HP, PlayerStats.Atk }, { PlayerStats.MovSpd, PlayerStats.Atk }, { PlayerStats.Def, PlayerStats.Atk }, { PlayerStats.HP, PlayerStats.Atk }, { PlayerStats.MovSpd, PlayerStats.Atk }, { PlayerStats.Def, PlayerStats.Atk }, { PlayerStats.MovSpd, PlayerStats.Atk } }; levelUpgradeBonuses = new float[,] { { 1, 0.5f}, { 1, 0.5f}, { 1, 0.5f}, { 20, 0.5f}, { 3, 1.5f}, { 1, 1.0f}, { 20, 1.0f}, { 2, 1.0f}, { 1, 1.0f}, { 3, 3.0f} }; }
public void SetData(PlayerStats stats) { this.stats = stats; this.cooldown = Skills.HEAL_COOLDOWN; inUse = false; timer = 0; }
public void setup(PlayerStats ps, float damageTick, Vector3 endPos) { owner = ps.transform; tickDamage = damageTick * ps.maxHealth; Destination = endPos; speed *= (1 + (ps.Agility / 100)); }
void Start() { playerStats = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<PlayerStats>(); sceneFadeInOut = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<SceneFadeInOut>(); persistentData = GameObject.FindGameObjectWithTag (Tags.mainCamera).GetComponent<PersistentData> (); centerMessageController = GameObject.FindGameObjectWithTag (Tags.canvas).GetComponentInChildren<CenterMessageController> (); }
//Overrides public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame) { foreach (GameObject target in targets) { target.SetActive(setActiveTo); } }
void Awake() { coords = new int[2]; lastCoords = new int[2]; canSee = new List<Player> (); m_AttackAxisInUse = false; tr = transform; CombatMode = false; pos = transform.position; currentPath = new List<Vector2> (); controller = GetComponent<PlayerController>(); workingAI = new AIBase (this); lastInput = Vector3.one; playerStats = new PlayerStats (); currentState = CharacterState.Still; controller.SetSpeed (playerStats.GetSpeed()); isStuck = 0; canAttack = "Enemy"; coolDownLimit = playerStats.GetAttackCooldown(); currentAttackCoolDown = 0; inventory = GetComponent<InventoryBase>(); weaponController = GetComponentInChildren<WeaponController> (); anim = GetComponent<Animator>(); spriteRen = GetComponent<SpriteRenderer> (); //seeker = GetComponent<Seeker> (); }
void Awake() { detectionZone = GetComponent<SphereCollider>(); rigidbody = GetComponent<Rigidbody>(); playerStats = References.player.GetComponent<PlayerStats>(); References.stateManager.changeState += onChangeState; }
protected Item(string name, int cost, string description, PlayerStats playerStats) { Name = name; Cost = cost; Description = description; Stats = playerStats; }
// Use this for initialization void Start() { maxHP = HP = 40; damage = 5; Player = GameObject.Find ("Player"); ps = Player.GetComponent<PlayerStats> (); }
void Start() { player = gameObject.GetComponent<Player> (); playerStats = player.playerStats; animator = gameObject.GetComponent<Animator> (); animator.speed = 5; }
public bool Paint(PlayerStats shooter, Collision info) { if (!m_Initialized) { Initialize (); } Color color = shooter.PlayerColor; color.a = 1f; foreach (ContactPoint p in info.contacts) { RaycastHit hit; Ray ray = new Ray (p.point + p.normal, -p.normal); if (p.otherCollider.Raycast (ray, out hit, 2f)) { Vector2 uv = hit.textureCoord; int x = (int)(uv.x * m_Texture.width); int y = (int)(uv.y * m_Texture.height); for(int row = 0; row < m_Splat.height; row++) { for(int col = 0; col < m_Splat.width; col++) { Color c0 = m_SplatPixels[row * m_Splat.width + col]; Color c1 = color; if(c0.a != 1f) { m_Texture.SetPixel ((int)(x-m_Splat.width/2 + col), (int)(y-m_Splat.height/2 + row), c1); } } } m_Texture.Apply (); } } return true; }
public bool Paint(PlayerStats shooter, RaycastHit info) { if (!m_Initialized) { Initialize (); } Color color = shooter.PlayerColor; color.a = 1f; Vector2 uv = info.textureCoord; int x = (int)(uv.x * m_Texture.width); int y = (int)(uv.y * m_Texture.height); for(int row = 0; row < m_Splat.height; row++) { for(int col = 0; col < m_Splat.width; col++) { Color c0 = m_SplatPixels[row * m_Splat.width + col]; Color c1 = color; if(c0.a != 1f) { m_Texture.SetPixel ((int)(x-m_Splat.width/2 + col), (int)(y-m_Splat.height/2 + row), c1); } } } m_Texture.Apply (); return true; }
// Use this for initialization void Awake () { player = GameObject.FindGameObjectWithTag("Player"); playerStats = player.GetComponent<PlayerStats>(); enemyStats = GetComponent<MinionsStats>(); //anim = GetComponent<Animator>(); }
void Update() { if (target != null) { transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target.position - transform.position), 5 * Time.deltaTime); if (Vector3.Distance(target.position, transform.position) >= 0.5) { transform.position += transform.forward * moveSpeed * Time.deltaTime; } else { if (target.tag == "Player") { HpPlayer = target.GetComponent<PlayerStats>(); Destroy(gameObject); HpPlayer.TakeDamage(damege); } else { HpEnemy = target.GetComponent<EnemyHP>(); Destroy(gameObject); HpEnemy.TakeDamage(damege); } } } if (target == null) { Destroy(gameObject); } }
/// <summary> /// Initializes or resets all data in the program. /// </summary> private void InitializeData() { this.characterClass = new CharacterClass(1, 1, 1, 1, 1, 1, 1); this.playerStats = new PlayerStats(this.characterClass.Clone() as CharacterClass); this.ResetPropertyGrids(); }
/// <summary> /// Deletes the first player stat in the table using the class definition. No need for SQL here. /// </summary> /// <param name='playerID'> /// The ID of the player to update /// </param> private void DeletePlayerStats_Simple(int playerID) { // Set up a player stats class, setting the key field PlayerStats playerStats = new PlayerStats { PlayerID = playerID }; dbManager.Delete<PlayerStats>(playerStats); }
IEnumerator BlowUpInFace(PlayerStats ps) { // TODO: Add Confetti and funzies (jack in the box!) int stuffz = 42; for (int i = 0; i < stuffz; i++) { GameObject go = null; int rnd = Random.Range(0, 5); switch (rnd) { case(0): go = banana; break; case (1): go = stick; break; case (2): go = sap; break; case (3): go = leaf; break; default: go = berries(berry, ps); break; } AreaPlacement(5, transform.position + transform.up * 3, go); yield return new WaitForSeconds(.5f); } }
//Overrides public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame) { if (!_ticking || (_ticking && resetOnRetrigger == true)) { animator.SetTrigger("StartTicking"); } }
/// <summary> /// Initialization method. Creates all the upgrade options. /// </summary> void Start() { levelUpgradeOptions = new PlayerStats[,] { { PlayerStats.Def, PlayerStats.HP }, { PlayerStats.MovSpd, PlayerStats.HP }, { PlayerStats.Def, PlayerStats.HP }, { PlayerStats.Atk, PlayerStats.HP }, { PlayerStats.Def, PlayerStats.HP }, { PlayerStats.MovSpd, PlayerStats.HP }, { PlayerStats.Atk, PlayerStats.HP }, { PlayerStats.Def, PlayerStats.HP }, { PlayerStats.Def, PlayerStats.HP }, { PlayerStats.Def, PlayerStats.HP } }; levelUpgradeBonuses = new float[,] { { 1, 5}, { 1, 5}, { 1, 5}, { 0.5f, 5}, { 3, 20}, { 2, 5}, { 1, 5}, { 2, 5}, { 2, 5}, { 4, 20} }; }
void Awake() { if (instance == null) { instance = this; } }
void Start() { m_LineRenderer = GetComponent<LineRenderer> (); m_Camera = GetComponentInParent<Camera> (); m_Control = GetComponentInParent<IControl> (); m_PlayerStats = GetComponentInParent<PlayerStats> (); }
void Start() { stats = PlayerStats.instance; stats.curHealth = stats.maxHealth; if (statusIndicator == null) { Debug.LogError("No status indicator referenced on Player"); } else { statusIndicator.SetHealth(stats.curHealth, stats.maxHealth); } GameMaster.gm.onToggleUpgradeMenu += OnUpgradeMenuToggle; GameMaster.gm.onToggleEscapeMenu += OnEscapeMenuToggle; audioManager = AudioManager.instance; if (audioManager == null) { Debug.LogError("PANIC! No audiomanager in scene."); } InvokeRepeating("RegenHealth", 1f / stats.healthRegenRate, 1f / stats.healthRegenRate); }
private void Start() { //states = GetComponentInParent<StateManager>(); bridge = GetComponentInParent <ExampleCharacterController>(); deathBridge = GetComponentInParent <PlayerStats>(); }
// Start is called before the first frame update void Start() { playerStats = GetComponent <PlayerStats>(); }
void EndPath() { PlayerStats.ReduceLives(1); WaveSpawner.EnemiesAlive--; Destroy(gameObject); }
void Start() { tutorialCoinsPacksPanel.SetActive(PlayerStats.GetShowTutorialStep(TutorialStep.CoinsPacks)); }
public static void Prefix(PlayerStats __instance, ref PlayerStats.HitInfo info, GameObject go) { if (EventPlugin.PlayerHurtPatchDisable) { return; } try { if (info.GetDamageType() == DamageTypes.Pocket) { bool allow = true; Events.InvokePocketDimDamage(__instance.gameObject, ref allow); if (!allow) { info.Amount = 0f; } if (info.Amount >= go.GetComponent <PlayerStats>().health) { Events.InvokePocketDimDeath(__instance.gameObject, ref allow); } if (!allow) { info.Amount = 0f; } } if (info.GetDamageType() == DamageTypes.Grenade) { Events.InvokePlayerHurt(__instance, ref info, go, info.PlyId); } else { Events.InvokePlayerHurt(__instance, ref info, go); } if (info.Amount >= go.GetComponent <PlayerStats>().health || (go.GetComponent <PlayerStats>().health - info.Amount) <= 1f) { CharacterClassManager ccm = go.GetComponent <CharacterClassManager>(); if (ccm != null) { if (DeathStuff.Contains(ccm.UserId)) { return; } DeathStuff.Add(ccm.UserId); } if (info.GetDamageType() == DamageTypes.Grenade) { Events.InvokePlayerDeath(__instance, ref info, go, info.PlyId); } else { Events.InvokePlayerDeath(__instance, ref info, go); } } } catch (Exception exception) { Log.Error($"PocketDimDamageEvent/PocketDimDeathEvent/PlayerHurtEvent error: {exception}"); } }
void Awake() { playerStats = GetComponent <PlayerStats>(); }
private void Start() { playerStats = GetComponent <PlayerStats>(); playerStats.HealthChanged += RenderHealth; playerStats.Death += OnDie; }
public void SetProjectileStats(int damage, DamageEffect statusNumber, float speed, float lifetime, float gravity, PlayerStats playerStats) { projectileDamage = damage; projectileDamageStatusNumber = statusNumber; projectileSpeed = speed; projectileLifeTime = lifetime; rigidbodyReference.gravityScale = gravity; ownerStats = playerStats; }
private async Task DoBash(IHubContext context, PlayerSetup.Player attacker, PlayerSetup.Player target, Room room) { attacker.Status = PlayerSetup.Player.PlayerStatus.Busy; await Task.Delay(500); if (attacker.ManaPoints < BashAb().MovesCost) { context.SendToClient("You are too tired to use Bash.", attacker.HubGuid); attacker.ActiveSkill = null; PlayerSetup.Player.SetState(attacker); return; } var die = new PlayerStats(); var dam = die.dice(1, 6); var ToBash = Helpers.GetPercentage(attacker.Skills.Find(x => x.Name.Equals(BashAb().Name, StringComparison.CurrentCultureIgnoreCase)).Proficiency, 95); int chance = die.dice(1, 100); bool alive = Fight2.IsAlive(attacker, target); var bashChance = BashSuccess(attacker, target); var bashStunRand = Helpers.Rand(1, 100); var isBashSuccess = bashChance >= bashStunRand ? true : false; if (alive) { if (ToBash > chance && isBashSuccess) { var damage = Helpers.Rand(2, 4 * (int)attacker.SizeCategory + bashChance / 20); var damageText = Fight2.DamageText(damage); if (Fight2.IsAlive(attacker, target)) { HubContext.Instance.SendToClient( "<span style='color:cyan'>You slam into " + Helpers.ReturnName(target, attacker, null).ToLower() + ", and send " + Helpers.ReturnName(target, attacker, null).ToLower() + " flying!</span>", attacker.HubGuid); HubContext.Instance.SendToClient( $"Your Bash {damageText.Value.ToLower()} {Helpers.ReturnName(target, attacker, null).ToLower()} [{dam}]", attacker.HubGuid); HubContext.Instance.SendToClient( Helpers.ReturnName(target, attacker, null) + " " + Fight2.ShowMobHeath(target), attacker.HubGuid); HubContext.Instance.SendToClient( $"<span style='color:cyan'>{Helpers.ReturnName(attacker, target, null)} sends you sprawling with a powerful bash!</span>", target.HubGuid); HubContext.Instance.SendToClient( Helpers.ReturnName(attacker, target, null) + "'s Bash " + damageText.Value.ToLower() + " you [" + dam + "]", target.HubGuid); foreach (var player in room.players) { if (player != attacker && player != target) { HubContext.Instance.SendToClient( Helpers.ReturnName(attacker, target, null) + " sends " + Helpers.ReturnName(target, attacker, null) + " sprawling with a powerful bash.", target.HubGuid); HubContext.Instance.SendToClient( Helpers.ReturnName(attacker, target, null) + "'s Bash " + damageText.Value.ToLower() + " " + Helpers.ReturnName(target, attacker, null), player.HubGuid); } } target.StunDuration = 6000; target.Status = PlayerSetup.Player.PlayerStatus.Stunned; target.HitPoints -= damage; if (target.HitPoints < 0) { target.HitPoints = 0; } if (!Fight2.IsAlive(attacker, target)) { Fight2.IsDead(attacker, target, room); } } } else { if (Fight2.IsAlive(attacker, target)) { //Randomly pick to output dodge, parry, miss var rand = Helpers.Rand(1, 4); string attackerMessage, targetMessage, observerMessage; if (rand <= 1) { attackerMessage = "Your Bash <span style='color:olive'>misses</span> " + Helpers.ReturnName(target, attacker, null); targetMessage = Helpers.ReturnName(attacker, target, null) + "'s Bash <span style='color:olive'>misses</span> you "; observerMessage = Helpers.ReturnName(attacker, target, null) + "'s <span style='color:olive'>misses</span> " + Helpers.ReturnName(target, attacker, null); } else if (rand > 1 && rand <= 2) { attackerMessage = Helpers.ReturnName(target, attacker, null) + " <span style='color:olive'>dodges</span> your Bash."; targetMessage = "You <span style='color:olive'>dodge</span> " + Helpers.ReturnName(attacker, target, null) + "'s Bash"; observerMessage = Helpers.ReturnName(target, attacker, null) + " <span style='color:olive'>dodges</span> " + Helpers.ReturnName(attacker, target, null) + "'s Bash."; } else { attackerMessage = Helpers.ReturnName(target, attacker, null) + " <span style='color:olive'>parries</span> your Bash"; targetMessage = "You <span style='color:olive'>parry</span> " + Helpers.ReturnName(attacker, target, null) + "'s Bash"; observerMessage = Helpers.ReturnName(target, attacker, null) + " <span style='color:olive'>parries</span> " + Helpers.ReturnName(attacker, target, null) + "'s Bash"; } HubContext.Instance.SendToClient(attackerMessage + " <br><br> ", attacker.HubGuid); HubContext.Instance.SendToClient(targetMessage + " <br><br> ", target.HubGuid); foreach (var player in room.players) { if (player != attacker && player != target) { HubContext.Instance.SendToClient( observerMessage, player.HubGuid); } } } } } //Bash / stun player Score.ReturnScoreUI(target); PlayerSetup.Player.SetState(attacker); Fight2.PerpareToFightBack(attacker, room, target.Name, true); attacker.ActiveSkill = null; }
void Awake() { playerHealth = GameObject.FindGameObjectWithTag(Tags.Player).GetComponent <PlayerStats>(); anim = GetComponent <Animator>(); }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> public Game() { //player = new CharacterConversable (); playerStats = new PlayerStats(); }
// Start is called before the first frame update void Start() { _players = FindObjectOfType <PlayerStats>(); _effect.Stop(); _goalAudio.Stop(); }
public void ViewMainMenu() { PlayerStats.SaveGame(); SceneManager.LoadScene(0); }
public void SupportRatePhase() { Debug.Log("Support Rate Phase"); PlayerStats player = current_player.GetComponent <PlayerStats>(); //Calc about it }
void Start() { stats = GAMER.GetComponent <PlayerStats>(); RedEffect = GetComponent <RedCoinEffect>(); }
private void Start() { battleCanvas.SetActive(false); playerStats = Player.Instance.playerStats; }
void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode) { Spawner.instance.ready = false; gm.roundFinished = false; gm.score = 0; TouchScript.instance.hitCombo = 0; TouchScript.instance.comboScore = 0; TouchScript.instance.ResetItems(); //PlayerPrefs.DeleteAll(); if (gm == null) { gm = FindObjectOfType <GameMaster>(); } PlayerStats initialSave = SaveSystem.Load(); if (initialSave.lastFinishedLevel == 0) { Debug.Log("New game! Need to save and load initial PlayerStats"); SaveSystem.Save(gm.playerStats); } if (gm != null) { gm.playerStats = SaveSystem.Load(); } if (scene.name.ToLower().Contains("level")) { //preparing hud TouchScript.instance.hitCombo = 0; TouchScript.instance.itemButtons[0] = GameObject.Find("ITEM1").GetComponent <Button>(); if (gm.playerStats.equipedItems[0] == PlayerItems.NOITEM) { TouchScript.instance.itemButtons[0].gameObject.SetActive(false); } else { TouchScript.instance.itemButtons[0].gameObject.SetActive(true); } TouchScript.instance.itemButtons[1] = GameObject.Find("ITEM2").GetComponent <Button>(); if (gm.playerStats.equipedItems[1] == PlayerItems.NOITEM) { TouchScript.instance.itemButtons[1].gameObject.SetActive(false); } else { TouchScript.instance.itemButtons[1].gameObject.SetActive(true); } TouchScript.instance.itemButtons[2] = GameObject.Find("ITEM3").GetComponent <Button>(); if (gm.playerStats.equipedItems[2] == PlayerItems.NOITEM) { TouchScript.instance.itemButtons[2].interactable = false; } else { TouchScript.instance.itemButtons[2].interactable = true; } TouchScript.instance.itemsOnCdText[0] = TouchScript.instance.itemButtons[0].transform.GetChild(0).GetComponent <TextMeshProUGUI>(); TouchScript.instance.itemsOnCdText[1] = TouchScript.instance.itemButtons[1].transform.GetChild(0).GetComponent <TextMeshProUGUI>(); TouchScript.instance.itemsOnCdText[2] = TouchScript.instance.itemButtons[2].transform.GetChild(0).GetComponent <TextMeshProUGUI>(); TouchScript.instance.itemsOnCdText[0].gameObject.SetActive(false); TouchScript.instance.itemsOnCdText[1].gameObject.SetActive(false); TouchScript.instance.itemsOnCdText[2].gameObject.SetActive(false); TouchScript.instance.SetUpItemButtons(); gm.UnPauseGame(); tent = GameObject.FindGameObjectWithTag("Player"); if (tent == null) { Debug.Log("No tent found!"); } AudioManager.instance.StopAll(); AudioManager.instance.PlaySound("forest"); starTime = Time.time; spawnPoint1 = GameObject.Find("SpawnPointLeftBottom").transform; spawnPoint2 = GameObject.Find("SpawnPointRightBottom").transform; KillText = GameObject.Find("Score").GetComponent <TextMeshProUGUI>(); KillText.fontSize = 50; TimerText = GameObject.Find("Timer").GetComponent <TextMeshProUGUI>(); Combo = GameObject.Find("Combo"); ComboText = Combo.GetComponent <TextMeshProUGUI>(); ComboTextAnimator = Combo.GetComponent <Animator>(); buttons = GameObject.FindGameObjectsWithTag("BUTTON"); buttonsPos = new Vector3[gm.buttons.Length]; for (int i = 0; i < gm.buttons.Length; i++) { gm.buttonsPos[i] = gm.buttons[i].GetComponent <RectTransform>().transform.position; } timerOn = true; hearts = GameObject.Find("HP"); gm.score = 0; for (int i = 0; i < gm.playerStats.hp; i++) { hearts.transform.GetChild(i).gameObject.SetActive(true); } health = gm.playerStats.hp;; if (scene.name == "FirstLevel") { Spawner.instance.Prepare(new MobAmountsForLevel[] { new MobAmountsForLevel(0, 20) }); } if (scene.name == "SecondLevel") { Spawner.instance.Prepare(new MobAmountsForLevel[] { new MobAmountsForLevel(0, 15), new MobAmountsForLevel(1, 10) }); } if (scene.name == "ThirdLevel") { Debug.Log(" gm.level3fly:" + gm.level3fly); Spawner.instance.Prepare(new MobAmountsForLevel[] { new MobAmountsForLevel(0, 10), new MobAmountsForLevel(1, 5), new MobAmountsForLevel(2, 5), new MobAmountsForLevel(3, 10) }); } if (scene.name == "DarkForestLevel") { Spawner.instance.Prepare(new MobAmountsForLevel[] { new MobAmountsForLevel(0, 10), new MobAmountsForLevel(1, 10), new MobAmountsForLevel(2, 10), new MobAmountsForLevel(3, 10) }); } if (scene.name == "SunnyVillLevel") { Spawner.instance.Prepare(new MobAmountsForLevel[] { new MobAmountsForLevel(0, 10), new MobAmountsForLevel(1, 10), new MobAmountsForLevel(2, 10) }); } if (scene.name == "HellVillLevel") { Spawner.instance.Prepare(new MobAmountsForLevel[] { new MobAmountsForLevel(0, 50), new MobAmountsForLevel(1, 50), new MobAmountsForLevel(2, 50) }); } gm.UnPauseGame(); } else { timerOn = false; } if (scene.name == "StartingScreen") { gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>(); gm.PauseGame(); Time.timeScale = 1f; AudioManager.instance.StopAll(); AudioManager.instance.PlaySound("menu"); timerOn = false; gm.playerStats = SaveSystem.Load(); } if (scene.name == "LvlSelect") { gm.itemBackPack = GameObject.FindGameObjectWithTag("LVLSELECTOR").GetComponent <ItemBackPack>(); } }
private void Awake() { controller = GetComponent <CharacterController>(); mover = GetComponent <PlayerMove>(); stats = GetComponent <PlayerStats>(); }
private void Awake() { _player = GameObject.FindObjectOfType <PlayerStats>(); _levelController = GameObject.FindObjectOfType <LevelController>(); }
void Start() { Stats = GameObject.FindObjectOfType <PlayerStats>(); }
void OnCollisionEnter2D(Collision2D other) { DirtStats otherDirtValues = other.gameObject.GetComponent <DirtStats>(); CloudStats otherCloudValues = other.gameObject.GetComponent <CloudStats>(); StoneStats otherStoneValues = other.gameObject.GetComponent <StoneStats>(); TreeStats otherTreeValues = other.gameObject.GetComponent <TreeStats>(); PlayerStats otherPlayerValues = other.gameObject.GetComponent <PlayerStats>(); BarrelStats otherBarrelValues = other.gameObject.GetComponent <BarrelStats>(); if (gameObject.tag == "PickedUpObject") { particleManager.SpawnBigSpark(this.transform.position); if (other.gameObject.tag == "Dirt") { otherDirtValues.dirtHP -= dirtATK; gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Stone") { otherStoneValues.stoneHP -= dirtATK; gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Cloud") { otherCloudValues.cloudHP -= dirtATK; gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Tree") { otherTreeValues.treeHP -= dirtATK; gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Wood") { otherTreeValues.treeHP -= dirtATK; gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Barrel") { otherBarrelValues.barrelHP -= dirtATK; gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Player") { otherPlayerValues.TakeDamage(dirtATK); gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Player2") { otherPlayerValues.TakeDamage(dirtATK); gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Player3") { otherPlayerValues.TakeDamage(dirtATK); gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } if (other.gameObject.tag == "Player4") { otherPlayerValues.TakeDamage(dirtATK); gameObject.tag = "Dirt"; RaycastScript.isThrown = false; } } }
private void Awake() { movement = FindObjectOfType <Character_Movement>(); m_playerStats = FindObjectOfType <PlayerStats>(); }
public void RestartLevel() { PlayerStats stats = GameObject.FindGameObjectWithTag("GameController").GetComponent <PlayerStats>(); stats.RestartLevel(); }
void Awake() { playerStats = FindObjectOfType <PlayerStats>(); LoadData(); }
// Update is called once per frame void Update() { transform.eulerAngles = new Vector3(0.0f, 0.0f, angle * Mathf.Rad2Deg); float distance = speed * Time.deltaTime * Time.timeScale; Vector2 direction = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)); if (!is_dying) { // Move until you hit a wall. // Lengthen tail until max current_length = Mathf.Min(current_length + distance, MAX_LENGTH); line_renderer.SetPosition(0, new Vector3(-current_length, 0.0f, 0.0f)); // Check if you hit a wall or enemy int mask; if (is_player_owned) { mask = CollisionMasks.player_shooting_mask; } else { mask = CollisionMasks.enemy_shooting_mask; } RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, distance + 1.0f, mask); // Now, move visually. transform.Translate(new Vector3(direction.x * distance, direction.y * distance, 0.0f), Space.World); if (hit.collider == null) { return; } // Didn't hit anything, keep going. // It hit something. // Player? if (Utils.IsPlayersCollider(hit.collider)) { if (!is_player_owned) { PlayerStats char_stats = hit.collider.gameObject.GetComponent <PlayerStats>(); if (char_stats == null) { return; } char_stats.Hit(damage); is_dying = true; } else { return; } // player can't hit themselves with their own bullet. Ignore this hit. } // Enemy? if (Utils.IsEnemyCollider(hit.collider)) { if (is_player_owned) { EnemyStats enemy_stats = hit.collider.gameObject.GetComponent <EnemyStats>(); if (enemy_stats == null) { #if UNITY_EDITOR Debug.LogError("An enemy was hit, but was missing an EnemyStats component."); #endif return; } enemy_stats.Hit(damage); is_dying = true; } else { return; } // enemies can't hit themselves. Ignore this hit. } // prepare to clean up. transform.Translate(new Vector3(direction.x * -distance, direction.y * -distance, 0.0f)); // undo transform.Translate(new Vector3(direction.x * hit.distance, direction.y * hit.distance, 0.0f)); // move to impact point. is_dying = true; } else { // shorten tail. current_length = Mathf.Max(current_length - distance, 0.0f); line_renderer.SetPosition(0, new Vector3(-current_length, 0.0f, 0.0f)); if (current_length <= 0.0f) { // TODO: impact sparks, noise? Destroy(this.gameObject); } } }
// Use this for initialization void Start() { shield = FindObjectOfType <ShieldBlock>(); thePS = FindObjectOfType <PlayerStats>(); }
private void Start() { myrigidbody2D = GetComponent <Rigidbody2D>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStats>(); playerLocation = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); }
// Use this for initialization void Start() { pStats = FindObjectOfType <PlayerStats>(); }
private void Start() { statsScript = player.GetComponent <PlayerStats>(); }
// Access component of GameMaster object, PlayerStats. void Start() { GameMaster = GameObject.Find("GameMaster").GetComponent <PlayerStats>(); Wave = GameObject.Find("GameMaster").GetComponent <WaveSpawner>(); posMaster = GameObject.Find("PositionMaster"); }