本文整理汇总了C#中CharacterController2D类的典型用法代码示例。如果您正苦于以下问题:C# CharacterController2D类的具体用法?C# CharacterController2D怎么用?C# CharacterController2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CharacterController2D类属于命名空间,在下文中一共展示了CharacterController2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Awake
// Use this for initialization
void Awake()
{
_controller = GetComponent<CharacterController2D>();
_controller.onTriggerEnterEvent += Absorb;
_controller.onTriggerStayEvent += Absorb;
_player = GetComponent<Player>();
}
开发者ID:MegaSonic,项目名称:SuperAcronaut,代码行数:8,代码来源:PlayerAbsorb.cs
示例2: Start
protected virtual void Start()
{
if (this._character == null)
{
this._character = this.GetComponent<CharacterController2D>();
}
}
开发者ID:temdisponivel,项目名称:Megaman,代码行数:7,代码来源:Weapon.cs
示例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;
}
开发者ID:krislerv,项目名称:Unity-Game,代码行数:7,代码来源:PlayerController.cs
示例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>();
}
开发者ID:Nitwoe,项目名称:Nommy,代码行数:11,代码来源:BubbleJumpPowerCommand.cs
示例5: Awake
void Awake()
{
animator = GetComponent<Animator>();
characterController2D = GetComponent<CharacterController2D>();
characterController2D.onControllerCollidedEvent += onControllerCollider;
input = GetComponent<AbstractInput> ();
}
开发者ID:hannesdvl,项目名称:Unity-PlatformerWorkshop,代码行数:7,代码来源:PlayerModel.cs
示例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>();
}
开发者ID:Abhalphiest,项目名称:smashthestack,代码行数:8,代码来源:RunnerBehavior.cs
示例7: ControllerEnter2D
/// Ustalenie JumpMagnitude
public void ControllerEnter2D(CharacterController2D controller)
{
if (JumpSound != null)
AudioSource.PlayClipAtPoint(JumpSound, transform.position);
controller.SetVerticalForce(JumpMagnitude);
}
开发者ID:tokramg,项目名称:UnityGame,代码行数:8,代码来源:JumpPlatform.cs
示例8: Awake
public void Awake()
{
IsDead = false;
controller = GetComponent<CharacterController2D>();
isFacingRight = transform.localScale.x > 0;
Health = maxHeath;
}
开发者ID:bo7mide,项目名称:2D-Adventure-Game,代码行数:7,代码来源:Player.cs
示例9: Start
protected override void Start()
{
base.Start ();
controller = GetComponent<CharacterController2D> ();
controller.onTriggerEnterEvent += onTriggerEnterEvent;
jumpTime = jumpDelay;
}
开发者ID:krislerv,项目名称:Unity-Game,代码行数:7,代码来源:BlobController.cs
示例10: Awake
void Awake()
{
_controller = GetComponent<CharacterController2D>();
_animator = GetComponent<Animator>();
_respawner = GetComponent<FallDeath>();
_flashlight = GetComponentInChildren<Flashlight>();
}
开发者ID:hammerfrenzy,项目名称:ludum-dare-33,代码行数:7,代码来源:Player.cs
示例11: Awake
public void Awake()
{
_controller = GetComponent<CharacterController2D>();
_direction = new Vector2(-1, 0); // Initializing looking to the left
_player = GameObject.FindObjectOfType<Player>();
_gReturning = false;
}
开发者ID:lemanou,项目名称:Circus-for-a-psycho,代码行数:7,代码来源:SimpleGiraffeAI.cs
示例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;
}
开发者ID:lemanou,项目名称:Circus-for-a-psycho,代码行数:7,代码来源:SimpleEnemyAI.cs
示例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.
}
开发者ID:Pumph0use,项目名称:FSM2D,代码行数:10,代码来源:FSMDemo.cs
示例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>();
}
开发者ID:Nitwoe,项目名称:Nommy,代码行数:8,代码来源:CandySpittingBehaviour.cs
示例15: Start
void Start()
{
controller = GetComponent<CharacterController2D>();
weaponManager = GetComponentInChildren<WeaponManager>();
anim = GameObject.Find("Player").GetComponent<Animator>();
InvokeRepeating("BroadcastCurrentPosition", .3f, .3f);
}
开发者ID:pearl2201,项目名称:Unity2D-Components,代码行数:8,代码来源:PlayerMovement.cs
示例16: Start
public void Start()
{
player = GetComponent<Player>();
controller = GetComponent<CharacterController2D>();
collector = GetComponent<Collector>();
scale = Camera.main.orthographicSize;
}
开发者ID:thijsdaniels,项目名称:Metroidvania,代码行数:8,代码来源:Inventory.cs
示例17: Awake
void Awake()
{
controller = GetComponent<CharacterController2D>();
controller.onControllerCollidedEvent += onControllerCollider;
controller.onTriggerEnterEvent += onTriggerEnterEvent;
controller.onTriggerExitEvent += onTriggerExitEvent;
}
开发者ID:Coolpix,项目名称:Unity,代码行数:8,代码来源:ControllerEnemyBall.cs
示例18: Start
public void Start()
{
controller = GetComponent<CharacterController2D>();
patrolSpeed = MoveSpeed;
PatrolTime = PatrolLenght/MoveSpeed;
startPatrolTime = PatrolLenght / MoveSpeed;
playerHealth = StaticVariables.PlayerHealth;
}
开发者ID:thom854c,项目名称:Spil-projekt-3,代码行数:8,代码来源:Enemy.cs
示例19: Awake
void Awake()
{
animator = GetComponent<Animator>();
spriteRenderer = GetComponent<SpriteRenderer>();
//touchpad.FingerTouchedEvent += JumpButton;
jumpSound = transform.FindChild("JumpSound").GetComponent<AudioSource>();
m_controller = GetComponent<CharacterController2D>();
}
开发者ID:baraujo,项目名称:caveraid,代码行数:8,代码来源:PlayerController.cs
示例20: Awake
void Awake()
{
characterController2D = GetComponent<CharacterController2D>();
body2D = GetComponent<Rigidbody2D>();
characterController2D.onControllerCollidedEvent += onCharacterControllerCollider;
characterController2D.onTriggerEnterEvent += onCharacterTriggerEnterEvent;
characterController2D.onTriggerStayEvent += onCharacterTriggerStayEvent;
characterController2D.onTriggerExitEvent += onCharacterTriggerExitEvent;
}
开发者ID:Evorlor,项目名称:Fitachi,代码行数:9,代码来源:CharacterTopDowner.cs
注:本文中的CharacterController2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论