本文整理汇总了C#中PlayerController.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerController.GetComponent方法的具体用法?C# PlayerController.GetComponent怎么用?C# PlayerController.GetComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerController
的用法示例。
在下文中一共展示了PlayerController.GetComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
player = FindObjectOfType<PlayerController> ();
gravityStore = player.GetComponent<Rigidbody2D> ().gravityScale;
camera = FindObjectOfType<CameraController> ();
healthManager = FindObjectOfType<HealthManager> ();
}
示例2: Start
void Start()
{
levelController = FindObjectOfType<LevelController>();
player = GetComponent<PlayerController>();
playerRB = player.GetComponent<Rigidbody2D>();
currentHealth = startingHealth;
}
示例3: SetPlayer
public void SetPlayer(PlayerController player)
{
this.player = player;
playerView = player.GetComponent<PhotonView>();
inited = true;
}
示例4: ActionManager
public ActionManager(PlayerController controller)
{
playerController = controller;
camera = controller.transform.FindChild ("Camera").gameObject.GetComponent<Camera>();
characterController = controller.GetComponent<CharacterController>();
playerController.RegisterUpdateDelegate(Update);
}
示例5: Attach
/// <summary>
/// Attaches the identifier to the specified Player.
/// </summary>
/// <param name="player"></param>
public void Attach(PlayerController player)
{
if (player == null)
return;
_capsCol = player.GetComponent<CapsuleCollider>();
if (_capsCol == null)
throw new System.ArgumentException("player should have a attached capsule collider");
_playerTransform = player.transform;
}
示例6: UseItem
public override void UseItem (PlayerController controller, Item item)
{
HealthSystem health = (HealthSystem)controller.GetComponent (typeof(HealthSystem));
if (health.ContainsHealthEffect(typeof(HealthBleeding)))
{
health.networkView.RPC("BleedingRPC", RPCMode.Server, false);
item.TakeFromStack(1);
}
}
示例7: Start
private void Start()
{
mainCam = Camera.main;
playerC = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
hook = playerC.GetComponent<GraplingHook>();
startBackgroundColor = mainCam.backgroundColor;
resetText.gameObject.SetActive(false);
}
示例8: Awake
// === 코드(Monobehaviour기본 기능 구현) ================
protected override void Awake () {
base.Awake ();
playerCtrl = PlayerController.GetController();
playerAnim = playerCtrl.GetComponent<Animator>();
hpMax = initHpMax;
hp = hpMax;
speed = initSpeed;
}
示例9: PickedUp
protected virtual void PickedUp(PlayerController player)
{
// send RPC to spawner to respawn item
if (transform.parent) {
transform.parent.GetComponent<PhotonView>().RPC ("PickedUp", PhotonTargets.All, null);
}
// send RPC to master client to destory this item
player.GetComponent<PhotonView>().RPC("DestroyObject", PhotonTargets.MasterClient, GetComponent<PhotonView>().viewID);
}
示例10: UpdateShieldBar
public void UpdateShieldBar()
{
if (player == null)
{
player = GameManager.instance.GetPlayer().GetComponent<PlayerController>();
upgrader = player.GetComponent<UpgradeController>();
}
float shieldPct = (player.Shield / player.MaxShield) * 100;
shieldbarXPos = -shieldbarRect.height + ((shieldPct / 100) * shieldbarRect.height);
}
示例11: UpdateExperienceBar
public void UpdateExperienceBar()
{
if (player == null)
{
player = GameManager.instance.GetPlayer().GetComponent<PlayerController>();
upgrader = player.GetComponent<UpgradeController>();
}
float expPct = (player.Experience / player.MaxExperience) * 100;
experiencebarXPos = -experiencebarRect.width + ((expPct / 100) * experiencebarRect.width);
}
示例12: Start
void Start ()
{
_player = GameObject.Find ("Player").GetComponent<PlayerController> ();
_timeAffected = GameObject.Find("Player").GetComponent<TimeAffected>();
_playerTargetable = _player.GetComponent<Targetable> ();
_playerMovement = _player.GetComponent<PlayerMovement> ();
_oilScreen = (Texture)Resources.Load ("OilScreen");
_shadowBlinkIcon = (Texture)Resources.Load ("ShadowBlinkIcon");
_layerJumpIcons[0] = (Texture)Resources.Load("LayerJumpIconToFront");
_layerJumpIcons[1] = (Texture)Resources.Load("LayerJumpIconToMiddle");
_layerJumpIcons[2] = (Texture)Resources.Load("LayerJumpIconToBack");
_layerJumpIcon = _layerJumpIcons[1];
_joyStickIcon = (Texture)Resources.Load ("JoyStick");
_joyStickPadIcon = (Texture)Resources.Load ("JoyStickPad");
_joyStickPadRect = new Rect (_joyStickOrigin.x - _joyStickPadSize / 2, _joyStickOrigin.y - _joyStickPadSize / 2,
_joyStickPadSize, _joyStickPadSize);
}
示例13: UpdateHealthBar
public void UpdateHealthBar()
{
if (player == null)
{
player = GameManager.instance.GetPlayer().GetComponent<PlayerController>();
upgrader = player.GetComponent<UpgradeController>();
}
float healthPct = (player.Health / player.MaxHealth) * 100;
healthbarXPos = -healthbarRect.height + ((healthPct / 100) * healthbarRect.height);
UpdateCriticalHealthEffect(healthPct);
}
示例14: Start
void Start()
{
_trail = this.GetComponent<TrailRenderer>();
_trail.time = Mathf.Infinity;
_player = GameObject.FindObjectOfType<PlayerController>();
this.transform.position = _player.transform.position;
_trail.startWidth = _player.transform.localScale.x;
_trail.endWidth = _player.transform.localScale.x;
Color c = _player.GetComponent<Fader>().GetColor();
c.a = 0.5f;
_trail.material.color = c;
}
示例15: Start
// Use this for initialization
void Start()
{
playerController = GetComponent<PlayerController>();
dude = playerController.GetComponent<Dude>();
greedTimerText = playerController.FindGreedTimerText (playerController.gameObject.name);
boostTimerText = playerController.FindBoostTimerText (playerController.gameObject.name);
wallDemoTimerText = playerController.FindWallDemoTimerText (playerController.gameObject.name);
invisibilityCooldownTimerText = playerController.FindInvisibilityTimerText (playerController.gameObject.name);
greedTimerText.gameObject.SetActive (false);
boostTimerText.gameObject.SetActive (false);
wallDemoTimerText.gameObject.SetActive (false);
invisibilityCooldownTimerText.gameObject.SetActive (false);
}