Пример #1
0
    // Use this for initialization
    void Start()
    {
        hero_index = 3;
        hero       = (GameObject)Instantiate(Resources.Load("Hero/" + hero_index.ToString()));
        hero.transform.SetParent(players.transform);
        switch (hero_index)
        {
        case 0:
            PlayerMes.getInstance().Init("1", 400, 400, 200, 200, 60, 20, 10, 10);
            break;

        case 1:

            PlayerMes.getInstance().Init("1", 400, 400, 200, 200, 60, 20, 10, 10);
            break;

        case 2:
            PlayerMes.getInstance().Init("1", 400, 400, 200, 200, 60, 20, 10, 10);
            break;

        case 3:
            PlayerMes.getInstance().Init("1", 400, 400, 200, 200, 60, 20, 10, 10);
            break;

        case 4:
            PlayerMes.getInstance().Init("1", 400, 400, 200, 200, 60, 20, 10, 10);
            break;
        }
    }
Пример #2
0
 void HeroDead()
 {
     if (PlayerMes.getInstance().BloodNum <= 0)
     {
         SceneManager.LoadScene(1);
     }
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     gameObject.GetComponent <Text>().text = PlayerMes.getInstance().MyName;
 }
Пример #4
0
 void AttackTo()
 {
     PlayerMes.getInstance().BloodNum -= hurt;
     OnAttack.Invoke((float)PlayerMes.getInstance().BloodNum / PlayerMes.getInstance().BloodMax);
     //print(PlayerMes.getInstance().BloodNum);
 }
Пример #5
0
 void FightTo()
 {
     enemys.gameObject.GetComponent <GhostBehaviour>().ghostBlood -= PlayerMes.getInstance().Attack;
     MusicManager.Instance.PlayMusic(ac[Random.Range(0, 2)]);
 }
Пример #6
0
 public void ItemEffect(Item item, bool isAdd)
 {
     if (!isAdd)
     {
         if (item.addBlood != 0)
         {
             if (PlayerMes.getInstance().BloodNum < PlayerMes.getInstance().BloodMax)
             {
                 if ((PlayerMes.getInstance().BloodNum + item.addBlood) >= PlayerMes.getInstance().BloodMax)
                 {
                     PlayerMes.getInstance().BloodNum = PlayerMes.getInstance().BloodMax;
                 }
                 else
                 {
                     PlayerMes.getInstance().BloodNum += item.addBlood;
                 }
             }
         }
         if (item.addBloodMax != 0)
         {
             PlayerMes.getInstance().BloodMax += item.addBloodMax;
         }
         if (item.addMagicNum != 0)
         {
             if (PlayerMes.getInstance().MagicNum < PlayerMes.getInstance().MagicMax)
             {
                 if ((PlayerMes.getInstance().MagicNum + item.addMagicNum) >= PlayerMes.getInstance().MagicMax)
                 {
                     PlayerMes.getInstance().MagicNum = PlayerMes.getInstance().MagicMax;
                 }
                 else
                 {
                     PlayerMes.getInstance().MagicNum += item.addMagicNum;
                 }
             }
         }
         if (item.addMagicMax != 0)
         {
             PlayerMes.getInstance().MagicMax += item.addMagicMax;
         }
         if (item.addAtk != 0)
         {
             PlayerMes.getInstance().Attack += item.addAtk;
         }
         if (item.addDef != 0)
         {
             PlayerMes.getInstance().Defence += item.addDef;
         }
         if (item.addEvd != 0)
         {
             PlayerMes.getInstance().HidePer += item.addEvd;
         }
         if (item.addCrt != 0)
         {
             PlayerMes.getInstance().BigHit += item.addCrt;
         }
     }
     else
     {
         if (item.addBloodMax != 0)
         {
             PlayerMes.getInstance().BloodMax -= item.addBloodMax;
         }
         if (item.addMagicMax != 0)
         {
             PlayerMes.getInstance().MagicMax -= item.addMagicMax;
         }
         if (item.addAtk != 0)
         {
             PlayerMes.getInstance().Attack -= item.addAtk;
         }
         if (item.addDef != 0)
         {
             PlayerMes.getInstance().Defence -= item.addDef;
         }
         if (item.addEvd != 0)
         {
             PlayerMes.getInstance().HidePer -= item.addEvd;
         }
         if (item.addCrt != 0)
         {
             PlayerMes.getInstance().BigHit -= item.addCrt;
         }
     }
 }
Пример #7
0
 public void OnEndValue()
 {
     PlayerMes.getInstance().MyName = gameObject.GetComponent <InputField>().text;
 }