예제 #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);
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     PMC_PlayerManagerClass = GetComponent<PlayerManager>();
     PD_PlayerDefense = GetComponent<PlayerDefense>();
     if(networkView.isMine){
         gameObject.AddComponent<AudioListener>();
     }
 }
예제 #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);
    }
예제 #4
0
 void Start()
 {
     allowInput         = true;
     lightAttackClass   = GetComponent <LightAttack>();
     mediumAttackClass  = GetComponent <MediumAttack>();
     heavyAttackClass   = GetComponent <HeavyAttack>();
     playerDefenseClass = GetComponent <PlayerDefense>();
     playerDashClass    = GetComponent <PlayerDash>();
 }
예제 #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();
 }
예제 #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);
    }
예제 #7
0
 public DefenseBase GetDefense(Planet planet, DefenseType type) => PlayerDefense.First(d => d.BelongsTo.Id == planet.Id && d.Type == type);
예제 #8
0
 // Use this for initialization
 void Start()
 {
     playerManager = GetComponent<PlayerManager>();
     playerMovement = GetComponent<PlayerMovement>();
     playerDefense = GetComponent<PlayerDefense>();
 }
예제 #9
0
 void Start()
 {
     playerDefense = GetComponent<PlayerDefense>();
     endSyncRotation = Quaternion.identity;
     initialized = true;
 }