本文整理汇总了C#中CharacterController2D类的典型用法代码示例。如果您正苦于以下问题:C# CharacterController2D类的具体用法?C# CharacterController2D怎么用?C# CharacterController2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CharacterController2D类属于命名空间,在下文中一共展示了CharacterController2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
// Use this for initialization
void Awake()
{
_controller = GetComponent<CharacterController2D>();
_controller.onTriggerEnterEvent += Absorb;
_controller.onTriggerStayEvent += Absorb;
_player = GetComponent<Player>();
}
示例2: Start
protected virtual void Start()
{
if (this._character == null)
{
this._character = this.GetComponent<CharacterController2D>();
}
}
示例3: Awake
void Awake()
{
controller = GetComponent<CharacterController2D> ();
currentHealth = maxHealth;
actionBar.GetComponent<ActionBar> ().fillActionBar (new Sprite[] {weaponPrefabs[0].GetComponent<Weapon>().icon, weaponPrefabs[1].GetComponent<Weapon>().icon, weaponPrefabs[2].GetComponent<Weapon>().icon} );
controller.onTriggerEnterEvent += onTriggerEnter;
}
示例4: BubbleJumpPowerCommand
/// <summary>
/// Creates the Bubble Jump Power Command
/// </summary>
/// <param name="PowerUser">Object which uses the power</param>
public BubbleJumpPowerCommand (GameObject PowerUser)
{
CC2D = PowerUser.GetComponent<CharacterController2D>();
PIH = PowerUser.GetComponent<PlayerInputHandler>();
A = PowerUser.GetComponent<Animator>();
BB = PowerUser.GetComponent<ButtBubbles>();
}
示例5: Awake
void Awake()
{
animator = GetComponent<Animator>();
characterController2D = GetComponent<CharacterController2D>();
characterController2D.onControllerCollidedEvent += onControllerCollider;
input = GetComponent<AbstractInput> ();
}
示例6: Start
// Use this for initialization
void Start()
{
audio = GetComponent<AudioSource>();
_characterController2D = GetComponent<CharacterController2D>();
_graphic = transform.FindChild("PlaceholderRunner").gameObject.GetComponent<SpriteRenderer>();
_animator = transform.FindChild("PlaceholderRunner").gameObject.GetComponent<Animator>();
}
示例7: ControllerEnter2D
/// Ustalenie JumpMagnitude
public void ControllerEnter2D(CharacterController2D controller)
{
if (JumpSound != null)
AudioSource.PlayClipAtPoint(JumpSound, transform.position);
controller.SetVerticalForce(JumpMagnitude);
}
示例8: Awake
public void Awake()
{
IsDead = false;
controller = GetComponent<CharacterController2D>();
isFacingRight = transform.localScale.x > 0;
Health = maxHeath;
}
示例9: Start
protected override void Start()
{
base.Start ();
controller = GetComponent<CharacterController2D> ();
controller.onTriggerEnterEvent += onTriggerEnterEvent;
jumpTime = jumpDelay;
}
示例10: Awake
void Awake()
{
_controller = GetComponent<CharacterController2D>();
_animator = GetComponent<Animator>();
_respawner = GetComponent<FallDeath>();
_flashlight = GetComponentInChildren<Flashlight>();
}
示例11: Awake
public void Awake()
{
_controller = GetComponent<CharacterController2D>();
_direction = new Vector2(-1, 0); // Initializing looking to the left
_player = GameObject.FindObjectOfType<Player>();
_gReturning = false;
}
示例12: Awake
public void Awake()
{
_controller = GetComponent<CharacterController2D>();
_direction = new Vector2(StartingX, 0); // Initializing moving to the left
_startPosition = transform.position; // Sets the initial value of the bool depending on where the character stands in a new level
Health = MaxHealth;
}
示例13: Awake
private float timer; //variable to calculate how long we have been doing something
void Awake()
{
//Cache our controller for use
control = GetComponent<CharacterController2D>();
SetUpState("Controllable"); //We must call this to setup each state we plan to have.
SetUpState("Dash"); //Lets go ahead and set up another state for testing.
SwitchState("Controllable"); //we have to call this once after we setup our states, to tell the machine which state to start in.
}
示例14: Awake
void Awake() {
_spriteRenderer = GetComponentInChildren<SpriteRenderer>();
_spPS = ((GameObject)Instantiate(candyParticlePrefab)).GetComponent<ParticleSystem>();
_spPS.transform.parent = transform;
_spPS.transform.localPosition = new Vector3(0.15f, 0, transform.position.z + 0.1f);
_spPS.Stop();
_CC2D = GetComponent<CharacterController2D>();
}
示例15: Start
void Start()
{
controller = GetComponent<CharacterController2D>();
weaponManager = GetComponentInChildren<WeaponManager>();
anim = GameObject.Find("Player").GetComponent<Animator>();
InvokeRepeating("BroadcastCurrentPosition", .3f, .3f);
}