Inheritance: MonoBehaviour
示例#1
0
 public void setup(Hurt hurt)
 {
     this.hurt = hurt;
     hurt.onDeath.AddListener(() =>
     {
         dead = true;
     });
 }
示例#2
0
    // Use this for initialization
    void Start()
    {
        controller = GetComponent <PlayerController> ();
        animator   = GetComponent <Animator> ();
        hurt       = GetComponent <Hurt> ();

        collectedB = 0;
        collectedY = 0;
    }
示例#3
0
 void Start()
 {
     rbody      = GetComponent <Rigidbody2D>();
     player     = GameObject.Find("Player").GetComponent <Rigidbody2D>();
     eDomain    = GameObject.Find("EDomain");
     zoneScript = eDomain.GetComponent <EnemyTriggerZone> ();
     hurtE      = GetComponent <Hurt> ();
     updateDistances();
 }
示例#4
0
    private void Start()
    {
        pause.enabled       = false;
        victory.enabled     = false;
        deathScreen.enabled = false;
        hint.enabled        = false;

        player_      = GameObject.FindGameObjectWithTag("Player").GetComponent <Hurt>();
        audioSource_ = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioSource>();
    }
示例#5
0
    void OnTriggerEnter2D(Collider2D other)
    {
        Hurt target = other.GetComponent <Hurt>();

        if (target != null)
        {
            manager.CharacterDestroyed();
            this.transform.SetPositionAndRotation(new Vector3(-3.07f, -0.994f, 0), other.transform.rotation);
        }
    }
示例#6
0
    private void Awake()
    {
        rb       = GetComponent <Rigidbody2D>();
        anim     = GetComponent <Animator>();
        sr       = GetComponent <SpriteRenderer>();
        mySource = GetComponent <AudioSource>();

        fsm       = new FSM();
        moveState = new Move(this, WalkSpeed);
        hurtState = new Hurt(this, TimeHurt);
        jumpState = new Jump(this, JumpForce, rb);
        jumpState.SetMaxJumps(JumpCount);
        stuckState = new Stuck(this, TimeStuck, VulnerableArea);
        idleState  = new Idle(this, 3.0f);
        deadState  = new Dead();
    }
示例#7
0
 // Use this for initialization
 void Start()
 {
     hurt = this;
 }
示例#8
0
 internal static void InvokeHurt(object player, object damageSource, int damage, bool isPvP, bool isCritical)
 {
     Hurt?.Invoke(null,
                  new HurtEventArgs((Player)player, (PlayerDeathReason)damageSource, damage, isPvP, isCritical));
 }
示例#9
0
 public void Oof()
 {
     Hurt?.Invoke();
 }