本文整理汇总了C#中UnityEngine.Collider2D.SendMessageUpwards方法的典型用法代码示例。如果您正苦于以下问题:C# Collider2D.SendMessageUpwards方法的具体用法?C# Collider2D.SendMessageUpwards怎么用?C# Collider2D.SendMessageUpwards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Collider2D
的用法示例。
在下文中一共展示了Collider2D.SendMessageUpwards方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerStay2D
void OnTriggerStay2D(Collider2D col){
if (col.CompareTag ("Door")) { // Player activated door
if (in_crouch > 0){
col.SendMessageUpwards("MovePlayerDown");
}else if (in_jump > 0){
col.SendMessageUpwards("MovePlayerUp");
}
GetComponent<Collider2D>().enabled = false;
}
}
示例2: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col)
{
if (col.isTrigger != true && col.CompareTag ("Enemy")) {
col.SendMessageUpwards("AttackEnemy", dmg);
col.gameObject.GetComponent<Rigidbody2D> ().AddForce (new Vector2 (4, 0) * 500.0f);
}
else if (col.isTrigger != true && col.CompareTag ("FlyEnemy")) {
col.SendMessageUpwards("AttackEnemy", dmg);
col.SendMessage("Attacked");
}
}
示例3: OnTriggerStay2D
void OnTriggerStay2D(Collider2D other){
if (timer <= Time.time) {
if (other.tag == "Player") {
other.SendMessageUpwards ("takeDamage", 5, SendMessageOptions.DontRequireReceiver);
timer = Time.time + 1.5f;
}
if (other.tag == "Enemy") {
other.SendMessageUpwards ("takeDamage", 1, SendMessageOptions.DontRequireReceiver);
timer = Time.time + 1.0f;
}
}
}
示例4: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col)
{
if (col.isTrigger != true && col.CompareTag("Enemy"))
{
col.SendMessageUpwards("adjustHealth", transform.parent.GetComponent<playerAttack>().damage);
}
if (col.isTrigger != true && col.CompareTag("Player"))
{
col.SendMessageUpwards("adjustHealth", transform.parent.GetComponent<ZombieAI>().damage);
}
}
示例5: OnTriggerEnter2D
public override void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag ("Player")) {
SwitchBodies();
other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
}
}
示例6: OnTriggerEnter2D
/*void update(){
direction = MovePlayer.anim.GetInteger ("Direction");
if (direction == 0) {
transform.position
}
}*/
void OnTriggerEnter2D (Collider2D col){
/*animSlash.SetBool("Attak",true);*/
if (col.isTrigger !=true)
{
col.SendMessageUpwards("Damage", dmg);
}
}
示例7: PostOnTriggerEnter2D
protected override void PostOnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag ("Player")) {
other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
DestroyObject();
}
}
示例8: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col)
{
if (col.isTrigger == true && col.CompareTag("Enemy"))
{
col.SendMessageUpwards("Damage", dmg);
}
}
示例9: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col)
{
if (col.isTrigger != true && col.CompareTag("Enemy"))
{
col.SendMessageUpwards("takingHITS", dmg);
}
}
示例10: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
//Debug.Log("Enemy collided with player", gameObject);
other.SendMessageUpwards ("ApplyDamage", damageValue, SendMessageOptions.DontRequireReceiver);
}
}
示例11: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player") {
audio.Play();
other.SendMessageUpwards("consumedItem", this);
StartCoroutine(DestroyAfterAudio());
}
}
示例12: OnTriggerStay2D
protected bool pierceEnemies; // Pierces through enemiess
#endregion Fields
#region Methods
protected virtual void OnTriggerStay2D(Collider2D other)
{
PreOnTriggerStay2D (other);
if (incrementDamage == true) {
if (other.CompareTag("Enemy"))
other.SendMessageUpwards ("ApplyDamage", damage * Time.deltaTime, SendMessageOptions.DontRequireReceiver);
}
PostOnTriggerStay2D (other);
}
示例13: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col){
direction = (player.GetComponent<PlayerMovement>().facingRight ? 1 : -1);
if (col.isTrigger != true && col.CompareTag ("Enemy")) {
col.SendMessageUpwards("MeleeDamage", damage*direction);
GetComponent<Collider2D>().enabled = false;
}
}
示例14: onTriggerEnter2D
void onTriggerEnter2D(Collider2D col)
{
Debug.Log("collision1");
if (col.isTrigger != true && col.CompareTag("Enemy"))
{
col.SendMessageUpwards("attacking", jabDamage);
Debug.Log("collision");
}
}
示例15: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.CompareTag("Player2"))
{
other.SendMessageUpwards("Player 1 attacks Player 2");
Debug.Log( "collide (name) : " + other.gameObject.name );
Debug.Log( "collide (tag) : " + other.gameObject.tag );
}
}