Before a int [] number problem, then I just figure out, but now the playerAttack I really no way out,
The code
using System.Collections;
using System.Collections.Generic;
Using UnityEngine;
Using UnityEngine. UI;
Public class AbilityUp: MonoBehaviour
{
Public Image [] dialogBox;
Public Text [] dialogBoxText;
Public Button [] buttons;
Int a, b, c;
Public int [] number;
Private PlayerAttack PlayerAttack;
Private PlayerHealth PlayerHealth;
Private GameData GameData;
Private PlayerUp PlayerUp;
Private string [] texts;
Private int caseuse;
//Start is called before the first frame update
Void the Start ()
{
GameData=https://bbs.csdn.net/topics/GameObject.FindGameObjectWithTag (" gameData "). GetComponent
PlayerAttack playerUp=GameObject. FindGameObjectWithTag (" "). The GetComponent
PlayerAttack playerAttack=GameObject. FindGameObjectWithTag (" "). The GetComponent
PlayerHealth=GameObject. FindGameObjectWithTag (" Player ".) GetComponent
DoRange ();
}
//Update is called once per frame
Void the Update ()
{
}
Void p ()
{
Print (playerAttack. Name);
}
Void doRange ()
{
for (int i=0; I & lt; 3; I++)
{
Number [I]=Random. Range (0, 4);
//judge did not get the same key value
If (I.=0)
{
for (int j=0; J & lt; i; J++)
{
If (number [I]==number [j])
{
I -=I;
}
}
}
}
}
Public void SetWords ()
{
for(int i=0; i<3; I++)
{
DialogBoxText [I]. Text=gameData. Load (number [I]);
If (I==0)
{
A=number [I];
}
If (I==1)
{
B=number [I];
}
If (I==2)
{
C=number [I];
}
}
}
Public void for the ()
{
//playerUp. Up (number [0]).
This. The gameObject. SetActive (false);
}
Public void button2 ()
{
p();
The Up (b);
This. The gameObject. SetActive (false);
}
Public void button3 ()
{
The Up (c);
This. The gameObject. SetActive (false);
}
Private void (A)
{
}
Private void Up (int I)
{
If (I==0)
{
PlayerAttack. AttackToHealth +=2;
}
If (I==1)
{
PlayerAttack. Critcal +=0.1 f;
}
If (I==2)
{
PlayerAttack. Critcal_Hit +=0.2 f;
}
If (I==3)
{
PlayerHealth. MaxHealth=(int) ((int) playerHealth. MaxHealth * 1.2);
}
If (I==4)
{
PlayerAttack. PlayerDamage +=1;
}
If (I==5)
{
Print (" yes ");
}
}
}
The most ridiculous is, I instantiated in the start function is the debug output, yao ran out to the below