• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PlayerHealth类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PlayerHealth的典型用法代码示例。如果您正苦于以下问题:C# PlayerHealth类的具体用法?C# PlayerHealth怎么用?C# PlayerHealth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlayerHealth类属于命名空间,在下文中一共展示了PlayerHealth类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
    }
开发者ID:biikatto,项目名称:zeroweight,代码行数:28,代码来源:PlayerDelegate.cs


示例2: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player").transform;
     playerHealth = player.GetComponent<PlayerHealth>();
     nerdHealth = GetComponent<NerdsHealth>();
     nav = GetComponent<NavMeshAgent>();
 }
开发者ID:gitjiaying,项目名称:minorProject,代码行数:7,代码来源:NerdsMovement.cs


示例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>();
	}
开发者ID:lcwadle,项目名称:Programming-Panthers,代码行数:10,代码来源:EnemyAttack.cs


示例4: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent<PlayerHealth>();
     nerdsHealth = GetComponent<NerdsHealth>();
     nerd = GameObject.FindGameObjectWithTag("Nerd");
 }
开发者ID:gitjiaying,项目名称:minorProject,代码行数:7,代码来源:NerdsAttack.cs


示例5: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     playerHealth = player.GetComponent <PlayerHealth> ();
     //enemyHealth = GetComponent<EnemyHealth>();
     anim = GetComponent <Animator> ();
 }
开发者ID:stellarnull,项目名称:LittleGamesUnity,代码行数:7,代码来源:EnemyAttack.cs


示例6: Awake

 void Awake()
 {
     playerMovement = GetComponent<PlayerMovement>();
     playerHealth = GetComponent<PlayerHealth>();
     anim = GetComponent<Animator>();
     p2Health = GameObject.Find("Player02").GetComponent<Player2Health>();
 }
开发者ID:RayMicheau,项目名称:AnimationFinalSubmissionUnity,代码行数:7,代码来源:PlayerAnimationScript.cs


示例7: Start

    // Use this for initialization
    void Start()
    {
        target = GameObject.FindWithTag("Player");
        targetHealth = target.GetComponent<PlayerHealth>();

        attackLeap = gameObject.GetComponent<PseudoSpiderAttackLeap> ();
    }
开发者ID:radarsu,项目名称:martian-terror,代码行数:8,代码来源:PseudoSpiderAttack.cs


示例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);
        }
    }
开发者ID:dshook,项目名称:chaos-king,代码行数:32,代码来源:EnemyMovement.cs


示例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;
 }
开发者ID:NattyBumppo,项目名称:SiloProject,代码行数:8,代码来源:PlayerLungs.cs


示例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");

	}
开发者ID:swindeler,项目名称:MethodsGame,代码行数:8,代码来源:Traps.cs


示例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();
	}
开发者ID:WASDMagician,项目名称:Northern_Jam_BGJ_10,代码行数:8,代码来源:Player_Controller.cs


示例12: Awake

	void Awake()
	{
		player = GameObject.FindGameObjectWithTag ("Player");
		anim = GetComponent <Animator> ();
		playerhealth = player.GetComponent<PlayerHealth> ();
		nav = GetComponent<NavMeshAgent> ();
	}
开发者ID:krishnaarjun,项目名称:projectarrow,代码行数:7,代码来源:AttackAI.cs


示例13: Awake

 public void Awake()
 {
     //Initialize components
     player = GameObject.FindWithTag("Player");
     playerHealth = player.GetComponent<PlayerHealth>();
     rend = GameObject.FindWithTag("RendPlayer").GetComponent<Renderer>();
 }
开发者ID:FERRERDEV,项目名称:MonstersAttack,代码行数:7,代码来源:RedCube.cs


示例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>();
 }
开发者ID:radarsu,项目名称:martian-terror,代码行数:9,代码来源:CreagAttackStandard.cs


示例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;
    }
开发者ID:Smlep,项目名称:Illumnia,代码行数:27,代码来源:TrollAttack.cs


示例16: Start

 // Use this for initialization
 void Start()
 {
     CurrentHealth = StartingHealth;
     PlayerRef = GameObject.FindGameObjectWithTag("Player");
     OxyScriptRef = PlayerRef.GetComponent<PlayerOxygen>();
     HealthScriptRef = PlayerRef.GetComponent<PlayerHealth>();
 }
开发者ID:jmazzola,项目名称:Damage-Control-Unity-Prototype,代码行数:8,代码来源:LifeSupportScript.cs


示例17: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player").transform;  //finds the player in the scene
     playerHealth = player.GetComponent <PlayerHealth> ();
     enemyHealth = GetComponent <EnemyHealth> ();
     nav = GetComponent <NavMeshAgent> ();
 }
开发者ID:SGTMcClain,项目名称:COSC-330_TopDownShoot,代码行数:7,代码来源:EnemyMovement.cs


示例18: Awake

	void Awake ()
	{
		player = GameObject.Find("Police");												//Find the police GameObject
		playerHealth = player.GetComponent <PlayerHealth> (); 							//get the PlayerHealth Script 
		enemyHealth = GetComponent <EnemyHealth>();										//Get EnemyHealth Script
	
	}
开发者ID:dunkelblume,项目名称:DND,代码行数:7,代码来源:EnemyAttack.cs


示例19: Awake

 // Use this for initialization
 void Awake()
 {
     spawnenemy = GameObject.Find("boss3spawn");
     Boss3Move.lebosspeutbouger = false;
     player = GameObject.FindGameObjectWithTag("Player");
     boss = GameObject.Find("CaveWorm");
     baril_pos_1 = GameObject.Find("baril_pos_1");
     baril_pos_2 = GameObject.Find("baril_pos_2");
     baril_pos_3 = GameObject.Find("baril_pos_3");
     baril_pos_4 = GameObject.Find("baril_pos_4");
     laser1 = GameObject.Find("laser1");
     laser2 = GameObject.Find("laser2");
     laser3 = GameObject.Find("laser3");
     laser4 = GameObject.Find("laser4");
     baril_fin = GameObject.Find("baril_fin");
     baril_start = GameObject.Find("baril_start");
     baril_start_h = GameObject.Find("baril_start_h");
     baril_pos_1_h = GameObject.Find("baril_pos_1_h");
     baril_pos_2_h = GameObject.Find("baril_pos_2_h");
     baril_pos_3_h = GameObject.Find("baril_pos_3_h");
     scriptdupersonnage = GameObject.FindGameObjectWithTag("Player").GetComponent<ScriptPersonnage>();
     enemyhealthSliderObjectGameObject = GameObject.FindGameObjectWithTag("BossHealthSlider3");
     playerHealth = player.GetComponent<PlayerHealth>();
     enemyHealth = GetComponent<EnemyHealth>();
     enemyHealthSlider = enemyhealthSliderObjectGameObject.GetComponent<Slider>(); // --
     enemyHealthSlider.maxValue = enemyHealth.startingHealth; // --
 }
开发者ID:Smlep,项目名称:Illumnia,代码行数:28,代码来源:Boss3Attack.cs


示例20: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player"); //find the player in the scene, used during awake so it only has to be called once
     playerHealth = player.GetComponent <PlayerHealth> (); //stores a reference to the PlayerHealth script
     enemyHealth = GetComponent<EnemyHealth>();
     anim = GetComponent <Animator> ();
 }
开发者ID:SGTMcClain,项目名称:COSC-330_TopDownShoot,代码行数:7,代码来源:EnemyAttack.cs



注:本文中的PlayerHealth类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PlayerID类代码示例发布时间:2022-05-24
下一篇:
C# PlayerFlag类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap