Example #1
0
    void DetermineRoundWinner()
    {
        int   tempWinnerID     = 0;
        float healthComparison = 0f;

        for (int i = 0; i < 2; ++i)
        {
            PlayerDefense defenseRef = defenseTriggers[i].GetComponent <PlayerDefense>();
            if (defenseRef.defenseHealthCurrent > healthComparison)
            {
                healthComparison = defenseRef.defenseHealthCurrent;
                tempWinnerID     = i;
            }
        }
        PlayerDefense player0DefenseRef = defenseTriggers [0].GetComponent <PlayerDefense> ();
        PlayerDefense player1DefenseRef = defenseTriggers [1].GetComponent <PlayerDefense> ();

        if (player0DefenseRef.defenseHealthCurrent == player1DefenseRef.defenseHealthCurrent)
        {
            GameObject.FindGameObjectWithTag("AUDIOMANAGER").GetComponent <AudioManager> ().PlayTieSound();
            roundOverText.GetComponent <Text> ().text = "TIE!";
            return;
        }
        else
        {
            //GameObject.FindGameObjectWithTag ("AUDIOMANAGER").GetComponent<AudioManager> ().StopBackgroundMusic();
            GameObject.FindGameObjectWithTag("AUDIOMANAGER").GetComponent <AudioManager> ().PlayRoundOverSound();
        }

        EnableScore(tempWinnerID);
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     PMC_PlayerManagerClass = GetComponent<PlayerManager>();
     PD_PlayerDefense = GetComponent<PlayerDefense>();
     if(networkView.isMine){
         gameObject.AddComponent<AudioListener>();
     }
 }
Example #3
0
    public void Def_DefLessThanDamage_HpLost()
    {
        PlayerDefense defense  = new PlayerDefense();
        var           expecthp = player.statusplayer.hp - (statusbug.atk - player.statusplayer.def);

        defense.Def(player.statusplayer, statusbug);

        Assert.AreEqual(expecthp, player.statusplayer.hp);
    }
 void Start()
 {
     allowInput         = true;
     lightAttackClass   = GetComponent <LightAttack>();
     mediumAttackClass  = GetComponent <MediumAttack>();
     heavyAttackClass   = GetComponent <HeavyAttack>();
     playerDefenseClass = GetComponent <PlayerDefense>();
     playerDashClass    = GetComponent <PlayerDash>();
 }
Example #5
0
 // Get necessary components.
 private void Awake()
 {
     sr   = GetComponent <SpriteRenderer>();
     audi = GetComponent <AudioSource>();
     anim = GetComponent <Animator>();
     rb   = GetComponent <Rigidbody2D>();
     coll = GetComponent <Collider2D>();
     // Set up the Singleton design pattern.
     if (instance == null)
     {
         instance = this;
     }
     blockspark.gameObject.SetActive(false);
     MakeHitSparkList();
 }
Example #6
0
    public void OpenMenu(Equipment.TypeOfEquipment _type)
    {
        Visible = true;
        // Set player stat info back to default
        PlayerStrength    = player.Stats.Strength;
        PlayerDefense     = player.Stats.Defense;
        strengthText.Text = PlayerStrength.ToString();
        defenseText.Text  = PlayerDefense.ToString();
        strengthText.AddColorOverride("font_color", Color.ColorN("White"));
        defenseText.AddColorOverride("font_color", Color.ColorN("White"));

        if (_type == Equipment.TypeOfEquipment.Weapon)
        {
            currentlyEquipped.Text = player.Equipment.Weapon.ItemName;
        }
        else if (_type == Equipment.TypeOfEquipment.Armor)
        {
            currentlyEquipped.Text = player.Equipment.Armor.ItemName;
        }

        AddEquipmentButtons(_type);
    }
Example #7
0
 public DefenseBase GetDefense(Planet planet, DefenseType type) => PlayerDefense.First(d => d.BelongsTo.Id == planet.Id && d.Type == type);
Example #8
0
 // Use this for initialization
 void Start()
 {
     playerManager = GetComponent<PlayerManager>();
     playerMovement = GetComponent<PlayerMovement>();
     playerDefense = GetComponent<PlayerDefense>();
 }
Example #9
0
 void Start()
 {
     playerDefense = GetComponent<PlayerDefense>();
     endSyncRotation = Quaternion.identity;
     initialized = true;
 }