Ejemplo n.º 1
0
    // Use this for initialization

    public void ReactToHit()
    {
        if (shotcounter == 1)
        {
            Shooting behavior = GetComponent <Shooting> ();
            if (behavior != null)
            {
                behavior.SetAlive(false);
            }

            WanderingNPC b = GetComponent <WanderingNPC> ();
            if (b != null)
            {
                b.SetAlive(false);
            }

            GameObject s  = GameObject.FindGameObjectWithTag("Respawn");
            Spawning   sp = s.GetComponent <Spawning> ();
            sp.decrementCounter();


            StartCoroutine(Die());
        }
        else
        {
            shotcounter++;
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        this._collider     = this.gameObject.GetComponent <CapsuleCollider2D>();
        this._npc          = this.gameObject.GetComponent <WanderingNPC>();
        this._initPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);

        this._layer = LayerMask.LayerToName(this.gameObject.layer);

        layerMask = (1 << LayerMask.NameToLayer("Player")) | (1 << LayerMask.NameToLayer("Baby Limits"));
        Messenger.AddListener(GameEvent.DEATH.ToString(), OnDeath);
    }
Ejemplo n.º 3
0
    private void Start()
    {
        _body = GetComponent <Rigidbody2D>();
        _anim = GetComponent <Animator>();
        _box  = GetComponent <BoxCollider2D>();
        _npc  = GetComponent <WanderingNPC>();

        this.speed     = _npc.Speed();
        this.jumpForce = _npc.JumpForce();
        this.jumpReset = _npc.JumpReset();
        this.direction = _npc.Direction();
        layerMask      = (1 << LayerMask.NameToLayer("Player")) | (1 << LayerMask.NameToLayer("Enemy Limits"));

        StartCoroutine("RandomJump");
    }
Ejemplo n.º 4
0
 void Awake()
 {
     m_wanderingNPC = GetComponent <WanderingNPC>();
 }