Inheritance: ScriptableObject
Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     TrackManager track = (TrackManager)FindObjectOfType (typeof(TrackManager));
     stats = track.GetStats();
     speed = stats.baseSpeed;
     thrusterSize = leftThruster.startSize;
 }
Exemplo n.º 2
0
 // 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);
    }
Exemplo n.º 5
0
 void Awake()
 {
     playerStats = GetComponent<PlayerStats>();
     References.stateManager.changeState += onChangeState;
     animations = GetComponentInChildren<Animations>();
     enemies = new System.Collections.Generic.List<GameObject>();
 }
Exemplo n.º 6
0
 /// <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);
 }
Exemplo n.º 7
0
 void Start()
 {
     defaulyPlayerStats = new PlayerStats();
     toxicDmgTimerRes = toxicDmgTimer;
     normalMoveSpeed = defaulyPlayerStats.moveSpeed;
     toxicMoveSpeed = defaulyPlayerStats.moveSpeed / moveSpeedDecrease;
 }
Exemplo n.º 8
0
    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}
                                                  };
    }
Exemplo n.º 10
0
 public void SetData(PlayerStats stats)
 {
     this.stats = stats;
     this.cooldown = Skills.HEAL_COOLDOWN;
     inUse = false;
     timer = 0;
 }
Exemplo n.º 11
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> ();
 }
Exemplo n.º 13
0
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     foreach (GameObject target in targets)
     {
         target.SetActive(setActiveTo);
     }
 }
Exemplo n.º 14
0
	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> (); 

	}
Exemplo n.º 15
0
 void Awake()
 {
     detectionZone = GetComponent<SphereCollider>();
     rigidbody = GetComponent<Rigidbody>();
     playerStats = References.player.GetComponent<PlayerStats>();
     References.stateManager.changeState += onChangeState;
 }
Exemplo n.º 16
0
 protected Item(string name, int cost, string description, PlayerStats playerStats)
 {
     Name = name;
     Cost = cost;
     Description = description;
     Stats = playerStats;
 }
Exemplo n.º 17
0
 // 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;
 }
Exemplo n.º 19
0
    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;
    }
Exemplo n.º 20
0
    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;
    }
Exemplo n.º 21
0
	// Use this for initialization
	void Awake () {
		player = GameObject.FindGameObjectWithTag("Player");
		playerStats = player.GetComponent<PlayerStats>();
		enemyStats = GetComponent<MinionsStats>();
		//anim = GetComponent<Animator>();

	}
Exemplo n.º 22
0
 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();
        }
Exemplo n.º 24
0
    /// <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);
    }
Exemplo n.º 25
0
 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);
     }
 }
Exemplo n.º 26
0
 //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}
                                                  };
    }
Exemplo n.º 28
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 29
0
 void Start()
 {
     m_LineRenderer = GetComponent<LineRenderer> ();
     m_Camera = GetComponentInParent<Camera> ();
     m_Control = GetComponentInParent<IControl> ();
     m_PlayerStats = GetComponentInParent<PlayerStats> ();
 }
Exemplo n.º 30
0
    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);
    }
Exemplo n.º 31
0
 private void Start()
 {
     //states = GetComponentInParent<StateManager>();
     bridge      = GetComponentInParent <ExampleCharacterController>();
     deathBridge = GetComponentInParent <PlayerStats>();
 }
Exemplo n.º 32
0
 // Start is called before the first frame update
 void Start()
 {
     playerStats = GetComponent <PlayerStats>();
 }
 void EndPath()
 {
     PlayerStats.ReduceLives(1);
     WaveSpawner.EnemiesAlive--;
     Destroy(gameObject);
 }
Exemplo n.º 34
0
 void Start()
 {
     tutorialCoinsPacksPanel.SetActive(PlayerStats.GetShowTutorialStep(TutorialStep.CoinsPacks));
 }
Exemplo n.º 35
0
        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}");
            }
        }
Exemplo n.º 36
0
 void Awake()
 {
     playerStats = GetComponent <PlayerStats>();
 }
Exemplo n.º 37
0
 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;
 }
Exemplo n.º 39
0
        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;
        }
Exemplo n.º 40
0
 void Awake()
 {
     playerHealth = GameObject.FindGameObjectWithTag(Tags.Player).GetComponent <PlayerStats>();
     anim         = GetComponent <Animator>();
 }
Exemplo n.º 41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Game"/> class.
 /// </summary>
 public Game()
 {
     //player = new CharacterConversable ();
     playerStats = new PlayerStats();
 }
Exemplo n.º 42
0
 // Start is called before the first frame update
 void Start()
 {
     _players = FindObjectOfType <PlayerStats>();
     _effect.Stop();
     _goalAudio.Stop();
 }
Exemplo n.º 43
0
 public void ViewMainMenu()
 {
     PlayerStats.SaveGame();
     SceneManager.LoadScene(0);
 }
Exemplo n.º 44
0
 public void SupportRatePhase()
 {
     Debug.Log("Support Rate Phase");
     PlayerStats player = current_player.GetComponent <PlayerStats>();
     //Calc about it
 }
Exemplo n.º 45
0
 void Start()
 {
     stats     = GAMER.GetComponent <PlayerStats>();
     RedEffect = GetComponent <RedCoinEffect>();
 }
Exemplo n.º 46
0
 private void Start()
 {
     battleCanvas.SetActive(false);
     playerStats = Player.Instance.playerStats;
 }
Exemplo n.º 47
0
    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>();
        }
    }
Exemplo n.º 48
0
 private void Awake()
 {
     controller = GetComponent <CharacterController>();
     mover      = GetComponent <PlayerMove>();
     stats      = GetComponent <PlayerStats>();
 }
Exemplo n.º 49
0
 private void Awake()
 {
     _player          = GameObject.FindObjectOfType <PlayerStats>();
     _levelController = GameObject.FindObjectOfType <LevelController>();
 }
Exemplo n.º 50
0
 void Start()
 {
     Stats = GameObject.FindObjectOfType <PlayerStats>();
 }
Exemplo n.º 51
0
    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;
            }
        }
    }
Exemplo n.º 52
0
 private void Awake()
 {
     movement      = FindObjectOfType <Character_Movement>();
     m_playerStats = FindObjectOfType <PlayerStats>();
 }
Exemplo n.º 53
0
    public void RestartLevel()
    {
        PlayerStats stats = GameObject.FindGameObjectWithTag("GameController").GetComponent <PlayerStats>();

        stats.RestartLevel();
    }
Exemplo n.º 54
0
 void Awake()
 {
     playerStats = FindObjectOfType <PlayerStats>();
     LoadData();
 }
Exemplo n.º 55
0
    // 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);
            }
        }
    }
Exemplo n.º 56
0
    // Use this for initialization
    void Start()
    {
        shield = FindObjectOfType <ShieldBlock>();

        thePS = FindObjectOfType <PlayerStats>();
    }
Exemplo n.º 57
0
 private void Start()
 {
     myrigidbody2D  = GetComponent <Rigidbody2D>();
     player         = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStats>();
     playerLocation = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
 }
Exemplo n.º 58
0
 // Use this for initialization
 void Start()
 {
     pStats = FindObjectOfType <PlayerStats>();
 }
Exemplo n.º 59
0
 private void Start()
 {
     statsScript = player.GetComponent <PlayerStats>();
 }
Exemplo n.º 60
0
// Access component of GameMaster object, PlayerStats.
    void Start()
    {
        GameMaster = GameObject.Find("GameMaster").GetComponent <PlayerStats>();
        Wave       = GameObject.Find("GameMaster").GetComponent <WaveSpawner>();
        posMaster  = GameObject.Find("PositionMaster");
    }