Exemplo n.º 1
0
 public override void Move()
 {//faz o controle de movimento
     NpcRB.velocity = new Vector3(Horizontal * Speed, NpcRB.velocity.y, Vertical * Speed);
     if (!IsRescued)
     {
         if (Horizontal != 0 || Vertical != 0)
         {
             NpcAnimator.SetBool("IsWalk", true);
         }
         else
         {
             NpcAnimator.SetBool("IsWalk", false);
         }
     }
 }
Exemplo n.º 2
0
    private void MoveOut()
    {//função que movimenta o objeto rpa fora da tela
        int Rand = Random.Range(0, 50);

        if (Rand < 25)
        {
            Horizontal = -1;
        }
        else
        {
            Horizontal = 1;
        }
        Speed    = 10;
        Vertical = 0.0f;
        this.gameObject.layer = LayerMask.NameToLayer("MovingOut");

        NpcAnimator.SetBool("Mask", Masked);
    }
    public override void Move()
    {//faz a movimentação do inimigo
        var pos = Gamecontroller.PlayerTransform.position;

        if (IsFollow && IsWalking)
        {
            if ((IsLookLeft && transform.position.x <= pos.x + 0.5f) ||
                (!IsLookLeft && transform.position.x >= pos.x - 0.5f))
            {
                IsWalking = false;
            }
            else
            {
                transform.position = Vector3.MoveTowards(transform.position, pos, Speed * Time.deltaTime);
            }
            NpcAnimator.SetBool("IsWalking", IsWalking);
        }
    }
Exemplo n.º 4
0
    private void SickOut()
    {//retirar o objeto contaminado e chamando a animação própria
        PersonSR.color = Color.white;

        Speed = 20;

        int Rand = Random.Range(0, 50);

        if (Rand < 25)
        {
            Horizontal = -1;
        }
        else
        {
            Horizontal = 1;
        }

        Vertical = 0.0f;
        this.gameObject.layer = LayerMask.NameToLayer("MovingOut");
        Gamecontroller.PlaySFX(Gamecontroller.SfxRescue);
        NpcAnimator.SetBool("IsRescued", IsRescued);
    }