Exemplo n.º 1
0
 void FixedUpdate()
 {
     Run(thisTransform, speedX);
     playerIsLive           = playerHp.CharIsLive();
     thisSpriteRender.color = Color.red;
     canAttack       = attackArea.OnColisionTrue;
     charactersMotor = attackArea.childrelCharMotor; // получаем компонент монстра если он находится а зоне атаки
 }
Exemplo n.º 2
0
    void Update()
    {
        backColision      = backView.GetComponent <FieldView>().OnColisionTrue;
        distanceThePlayer = Vector2.Distance(thisTransform.position, playerTransform.transform.position);

        if (monsterIsLive)
        {
            isFacingRight = ModelTurn(thisTransform, isFacingRight, backColision, backValue);
        }

        playerPositionX  = playerTransform.position.x;
        monsterPositionX = thisTransform.position.x;
        speedX           = FrontCollisionControl(playerPositionX, monsterPositionX, isFacingRight, speedX, maxSpeed);
        playerIsLive     = playerScript.playerIsLive;
        monsterIsLive    = monsterHp.CharIsLive();
        Attack();
        Dead();
    }