本文整理汇总了C#中PlayerHealth类的典型用法代码示例。如果您正苦于以下问题:C# PlayerHealth类的具体用法?C# PlayerHealth怎么用?C# PlayerHealth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerHealth类属于命名空间,在下文中一共展示了PlayerHealth类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
//private bool destroyed = false;
void Start(){
soundManager = gameObject.GetComponentInChildren<SoundManager>();
energy = maxEnergy;
score = FindObjectOfType(typeof(ScoreKeeper)) as ScoreKeeper;
playerControl = gameObject.GetComponentInChildren<PlayerControl>();
playerGUI = gameObject.GetComponentInChildren<PlayerGUI>();
playerHealth = gameObject.GetComponentInChildren<PlayerHealth>();
thrust = gameObject.GetComponentInChildren<Thrust>();
shield = gameObject.AddComponent<Shield>() as Shield;
shield.PDelegate = this;
foreach(Weapon weapon in gameObject.GetComponentsInChildren(typeof(IWeapon))){
if(weapon.gameObject.name == "Left weapon"){
leftWeapon = weapon;
leftWeapon.soundManager = soundManager;
}else if(weapon.gameObject.name == "Right weapon"){
rightWeapon = weapon;
rightWeapon.soundManager = soundManager;
}
}
StartCoroutine("RegenerateEnergy");
}
示例2: Awake
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player").transform;
playerHealth = player.GetComponent<PlayerHealth>();
nerdHealth = GetComponent<NerdsHealth>();
nav = GetComponent<NavMeshAgent>();
}
示例3: Awake
float timer; // Timer for counting up to the next attack.
void Awake ()
{
// Setting up the references.
player = GameObject.FindGameObjectWithTag ("Player");
playerHealth = player.GetComponent <PlayerHealth> ();
enemyHealth = GetComponent<EnemyHealth>();
}
示例4: Awake
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player");
playerHealth = player.GetComponent<PlayerHealth>();
nerdsHealth = GetComponent<NerdsHealth>();
nerd = GameObject.FindGameObjectWithTag("Nerd");
}
示例5: Awake
void Awake()
{
player = GameObject.FindGameObjectWithTag ("Player");
playerHealth = player.GetComponent <PlayerHealth> ();
//enemyHealth = GetComponent<EnemyHealth>();
anim = GetComponent <Animator> ();
}
示例6: Awake
void Awake()
{
playerMovement = GetComponent<PlayerMovement>();
playerHealth = GetComponent<PlayerHealth>();
anim = GetComponent<Animator>();
p2Health = GameObject.Find("Player02").GetComponent<Player2Health>();
}
示例7: Start
// Use this for initialization
void Start()
{
target = GameObject.FindWithTag("Player");
targetHealth = target.GetComponent<PlayerHealth>();
attackLeap = gameObject.GetComponent<PseudoSpiderAttackLeap> ();
}
示例8: FindClosestPlayer
void FindClosestPlayer()
{
players = GameObject.FindGameObjectsWithTag("Player");
if (transform == null)
{
return;
}
float minRange = float.MaxValue;
foreach (var p in players)
{
var tmpPlayerHealth = p.GetComponent<PlayerHealth>();
if (tmpPlayerHealth.currentHealth <= 0) continue;
var dist = Vector3.Distance(p.transform.position, transform.position);
if (dist < minRange)
{
minRange = dist;
playerTransform = p.transform;
}
}
if (playerTransform != null)
{
playerHealth = playerTransform.GetComponent<PlayerHealth>();
anim.SetBool("IsMoving", true);
}
else
{
anim.SetBool("IsMoving", false);
}
}
示例9: Start
// Use this for initialization
void Start()
{
//characterControl = this.GetComponent<CharacterControl>();
lungGUI = GameObject.Find("LungsFill").GetComponent<Image>(); //Is there a better way to get link to GUI object?
playerHealth = this.GetComponent<PlayerHealth>();
air = lungCapacity;
}
示例10: OnEnable
///onEnable looks for inputs for camera and button
void OnEnable(){
enemy = GameObject.Find("Enemy").GetComponent<PlayerHealth> ();
playerInput = GameObject.Find ("Main Camera").GetComponent<PlayerInput>();
trapAudio = GetComponent <AudioSource> ();
StartCoroutine("TrapActivate");
}
示例11: Start
// Use this for initialization
void Start () {
wanted_mode = CursorLockMode.Locked;
targetDirection = transform.localRotation.eulerAngles;
controller = GetComponent<CharacterController>();
health = GetComponent<PlayerHealth>();
Go_To_Spawn();
}
示例12: Awake
void Awake()
{
player = GameObject.FindGameObjectWithTag ("Player");
anim = GetComponent <Animator> ();
playerhealth = player.GetComponent<PlayerHealth> ();
nav = GetComponent<NavMeshAgent> ();
}
示例13: Awake
public void Awake()
{
//Initialize components
player = GameObject.FindWithTag("Player");
playerHealth = player.GetComponent<PlayerHealth>();
rend = GameObject.FindWithTag("RendPlayer").GetComponent<Renderer>();
}
示例14: Start
// private PseudoSpiderAttack theAttack;
// Use this for initialization
void Start()
{
theAnimation = GetComponent<Animation> ();
target = GameObject.FindWithTag("Player");
targetHealth = target.GetComponent<PlayerHealth>();
theAcidAttack = GetComponentInChildren<ParticleSystem>();
}
示例15: Attackpeudevie
IEnumerator Attackpeudevie()
{
Anim.Play("Attack_02");
// Reset the timer.
timer = 0f;
jouelaniamtiondattaque = true;
yield return new WaitForSeconds(0.6f);
timer = 0f;
// Première partie de l'anim
if (playerHealth.currentHealth > 0&&enemyHealth.currentHealth>0)
{
// ... damage the player.
playerHealth = target.GetComponent<PlayerHealth>();
playerHealth.RpcTakeDamage(attackDamage/3);
}
yield return new WaitForSeconds(1.4f);
timer = 0f;
// Seconde partie de l'anim
if (playerHealth.currentHealth > 0&&enemyHealth.currentHealth>0)
{
// ... damage the player.
playerHealth = target.GetComponent<PlayerHealth>();
playerHealth.RpcTakeDamage(attackDamage / 3);
}
jouelaniamtiondattaque = false;
}