Пример #1
0
    public bool moveEnemy()
    {
        _enemy.clearHited();
        double w = Math.Abs(enemyTransform.position.x - enemyModel.getPos());

        if (w > 0.1)
        {
            enemyTransform.position += new Vector3((float)(enemyModel.getSign() * 0.05), 0) * Time.timeScale;
            enemyRigidbody.AddForce(new Vector2(0, -10));
            return(false);
        }
        else
        {
            enemyTransform.position = new Vector3((float)enemyModel.getPos(), enemyTransform.position.y);
            enemyRigidbody.velocity = new Vector2(0, 0);
            _enemy.CreateGround();
            _enemy.setKinematic();
            enemyModel.setFlip(!enemyModel.getFlip());
            flipEnemey();
            return(true);
        }
    }