Home > Back-end >  Look not to understand, just learning unity soon, code bosses can explain this to me
Look not to understand, just learning unity soon, code bosses can explain this to me

Time:11-26

Public class Player
{
//declare a static instance
Public static Player Instance;
//get a static instance
Public static Player GetInstance ()
{
If (the Instance==null)
{
Player ins=new Player ();
The Instance=ins.
Return the Instance.
}
The else
{
Return the Instance.
}
}
Private string playerName="zhang SAN";
Private float maxHp=1000;
Private float currentHp=1000;
Private float maxMp=1000;
Private float currentMp=1000;
//public set access method
Public void Set_playName (string value)
{
PlayerName=value;
}
Public string Get_playerame ()
{
Return playerName;
}


Public void Set_maxHp (float value)
{
MaxHp=value;
}
Public float Get_maxHp ()
{
Return maxHp;
}
Public void Set_currentHp (float value)
{
CurrentHp=Mathf. Min (value, maxHp);
}
Public float Get_currentHp ()
{
Return currentHp;
}


Public void Set_maxMp (float value)
{
MaxMp=Mathf. Min (value, maxMp);
}
Public float Get_maxMp ()
{
Return maxMp;
}
Public void Set_currentMp (float value)
{
CurrentMp=Mathf. Min (value, maxMp);
}
Public float Get_currentMp ()
{
Return currentMp;
}
}

CodePudding user response:

This is not the unity of content and this is the most basic c # syntax defines some properties and methods

CodePudding user response:

C # basic grammar, defines some properties and methods

CodePudding user response:

This is a c # basic content

CodePudding user response:

Defines the attributes and the method of read and write several attributes

CodePudding user response:

This is a singleton, and some properties and methods

CodePudding user response:

You send the wrong place,,, there is no answer, c #,,

CodePudding user response:

Unity is rubbish, don't waste time, be inferior to learn UE4 (released UE5 is expected to the end), id Tech 7 engine, these is a high level of FPS game engine

CodePudding user response:

how to comment

CodePudding user response:

don't waste time

CodePudding user response:

Send the wrong place

CodePudding user response:

B stand a wheat buckle teach unity based

Also explain the code

You can see
  • Related